diff options
author | Andrew Tridgell <tridge@samba.org> | 2010-01-07 17:27:03 +1100 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2010-01-08 13:03:04 +1100 |
commit | cd65ce8a18b9ea9a8ce2338bc02c1b3e8ee10225 (patch) | |
tree | 6087595ed24ef03c4d1aab243df5baef90d6d786 /source4 | |
parent | ff968e487c9762727d7d2322f3e0fe81b6320cdf (diff) | |
download | samba-cd65ce8a18b9ea9a8ce2338bc02c1b3e8ee10225.tar.gz samba-cd65ce8a18b9ea9a8ce2338bc02c1b3e8ee10225.tar.bz2 samba-cd65ce8a18b9ea9a8ce2338bc02c1b3e8ee10225.zip |
s4-schema: make ldb_val to string comparison safer with nul termination
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4')
-rw-r--r-- | source4/dsdb/schema/schema_query.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/source4/dsdb/schema/schema_query.c b/source4/dsdb/schema/schema_query.c index 907c671257..75d9716070 100644 --- a/source4/dsdb/schema/schema_query.c +++ b/source4/dsdb/schema/schema_query.c @@ -39,7 +39,14 @@ static int strcasecmp_with_ldb_val(const struct ldb_val *target, const char *str { int ret = strncasecmp((const char *)target->data, str, target->length); if (ret == 0) { - return (target->length - strlen(str)); + size_t len = strlen(str); + if (target->length > len) { + if (target->data[len] == 0) { + return 0; + } + return 1; + } + return (target->length - len); } return ret; } |