diff options
author | Andrew Bartlett <abartlet@samba.org> | 2017-09-07 16:23:43 +1200 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2017-09-14 17:48:26 +0200 |
commit | 5311eb4c369bb566a87ad3e95dd58cf7f4014b21 (patch) | |
tree | bca8170ef40af8425a9e208e3a8110a633673547 /lib | |
parent | 0c87159b0e97824a9722fe87bc1adc2905eb1b96 (diff) | |
download | samba-5311eb4c369bb566a87ad3e95dd58cf7f4014b21.tar.gz |
ldb_tdb: Use memcmp rather than strncmp() in ltdb_key_is_record(), re_key() and re_index()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13016
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
(cherry picked from commit 3ce80cfb60d86a80efb6b66205f6d8d683791f6c)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ldb/ldb_tdb/ldb_index.c | 4 | ||||
-rw-r--r-- | 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 dbed867f94d..eb432d2d0f8 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 316a487bfe4..ccad8168a6e 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; } |