diff options
author | Matthieu Patou <mat@matws.net> | 2012-12-13 02:18:34 -0800 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2013-02-08 15:06:37 +1100 |
commit | 057896a090870ecec56ad0d2f960e55cef561e9e (patch) | |
tree | 1575f21e4a96ff1129fd626eacebeb8876824d57 /lib/ldb/common | |
parent | 87cbd9414bab2f0a71d71b2c145c11ee71acd573 (diff) | |
download | samba-057896a090870ecec56ad0d2f960e55cef561e9e.tar.gz samba-057896a090870ecec56ad0d2f960e55cef561e9e.tar.bz2 samba-057896a090870ecec56ad0d2f960e55cef561e9e.zip |
ldb: use strncmp instead of strcmp when comparing the val part
val part of a DN's component is DATA_BLOB and nothing insure that it
will be finished by a '\0'
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'lib/ldb/common')
-rw-r--r-- | lib/ldb/common/ldb_dn.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/ldb/common/ldb_dn.c b/lib/ldb/common/ldb_dn.c index b910489a8e..14596f6c37 100644 --- a/lib/ldb/common/ldb_dn.c +++ b/lib/ldb/common/ldb_dn.c @@ -1097,7 +1097,7 @@ int ldb_dn_compare_base(struct ldb_dn *base, struct ldb_dn *dn) if (b_vlen != dn_vlen) { return b_vlen - dn_vlen; } - ret = strcmp(b_vdata, dn_vdata); + ret = strncmp(b_vdata, dn_vdata, b_vlen); if (ret != 0) return ret; n_base--; @@ -1176,7 +1176,7 @@ int ldb_dn_compare(struct ldb_dn *dn0, struct ldb_dn *dn1) if (dn0_vlen != dn1_vlen) { return dn0_vlen - dn1_vlen; } - ret = strcmp(dn0_vdata, dn1_vdata); + ret = strncmp(dn0_vdata, dn1_vdata, dn0_vlen); if (ret != 0) { return ret; } |