From 3ce80cfb60d86a80efb6b66205f6d8d683791f6c Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 7 Sep 2017 16:23:43 +1200 Subject: [PATCH] ldb_tdb: Use memcmp rather than strncmp() in ltdb_key_is_record(), re_key() and re_index() Signed-off-by: Andrew Bartlett Reviewed-by: Douglas Bagnall --- lib/ldb/ldb_tdb/ldb_index.c | 4 ++-- lib/ldb/ldb_tdb/ldb_tdb.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/ldb/ldb_tdb/ldb_index.c b/lib/ldb/ldb_tdb/ldb_index.c index dbed867f94dd..eb432d2d0f86 100644 --- a/lib/ldb/ldb_tdb/ldb_index.c +++ b/lib/ldb/ldb_tdb/ldb_index.c @@ -1578,7 +1578,7 @@ static int re_key(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, void *st ldb = ldb_module_get_ctx(module); if (key.dsize > 4 && - strncmp((char *)key.dptr, "DN=@", 4) == 0) { + memcmp(key.dptr, "DN=@", 4) == 0) { return 0; } @@ -1647,7 +1647,7 @@ static int re_index(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, void * ldb = ldb_module_get_ctx(module); if (key.dsize > 4 && - strncmp((char *)key.dptr, "DN=@", 4) == 0) { + memcmp(key.dptr, "DN=@", 4) == 0) { return 0; } diff --git a/lib/ldb/ldb_tdb/ldb_tdb.c b/lib/ldb/ldb_tdb/ldb_tdb.c index 316a487bfe40..ccad8168a6e5 100644 --- a/lib/ldb/ldb_tdb/ldb_tdb.c +++ b/lib/ldb/ldb_tdb/ldb_tdb.c @@ -137,11 +137,11 @@ bool ltdb_key_is_record(TDB_DATA key) return false; } - if (strncmp((char *)key.dptr, "DN=", 3) == 0) { + if (memcmp(key.dptr, "DN=", 3) == 0) { return true; } - if (strncmp((char *)key.dptr, "ID=", 3) == 0) { + if (memcmp(key.dptr, "ID=", 3) == 0) { return true; } @@ -149,7 +149,7 @@ bool ltdb_key_is_record(TDB_DATA key) return false; } - if (strncmp((char *)key.dptr, "GUID=", 5) == 0) { + if (memcmp(key.dptr, "GUID=", 5) == 0) { return true; }