summaryrefslogtreecommitdiff
path: root/source4/lib/ldb
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-04-12 18:39:50 +1000
committerAndrew Tridgell <tridge@samba.org>2010-04-12 19:12:37 +1000
commit928fb861507e2abed86258582f27aad7d71b308e (patch)
treed464511a16a0bc768edd3596fde8f1252cf12d2d /source4/lib/ldb
parentacc81f96a45275b4bfe356fdc4dd3cc5f03775ff (diff)
downloadsamba-928fb861507e2abed86258582f27aad7d71b308e.tar.gz
samba-928fb861507e2abed86258582f27aad7d71b308e.tar.bz2
samba-928fb861507e2abed86258582f27aad7d71b308e.zip
s4-ldb: fixed a crash bug for non-UTF8 strings
when one of the strings was not valid UTF8, we would try to dereference NULL
Diffstat (limited to 'source4/lib/ldb')
-rw-r--r--source4/lib/ldb/common/attrib_handlers.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/source4/lib/ldb/common/attrib_handlers.c b/source4/lib/ldb/common/attrib_handlers.c
index 2a2bd0852e..2f4454c7b4 100644
--- a/source4/lib/ldb/common/attrib_handlers.c
+++ b/source4/lib/ldb/common/attrib_handlers.c
@@ -269,7 +269,8 @@ utf8str:
* options but to do a binary compare */
talloc_free(b1);
talloc_free(b2);
- if (memcmp(s1, s2, MIN(n1, n2)) == 0) {
+ ret = memcmp(s1, s2, MIN(n1, n2));
+ if (ret == 0) {
if (n1 == n2) return 0;
if (n1 > n2) {
return (int)toupper(s1[n2]);
@@ -277,6 +278,7 @@ utf8str:
return -(int)toupper(s2[n1]);
}
}
+ return ret;
}
u1 = b1;