summaryrefslogtreecommitdiff
path: root/lib/ldb
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2011-08-09 16:41:16 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-08-09 11:56:23 +0200
commitcba88a2b623e47cf97885bd45387049da1105930 (patch)
tree2c14c4f5b5af6d64985f66c289a7186786055567 /lib/ldb
parent60b6b338f7921bc3c5895e0d0fdbe79305f1be0c (diff)
downloadsamba-cba88a2b623e47cf97885bd45387049da1105930.tar.gz
samba-cba88a2b623e47cf97885bd45387049da1105930.tar.bz2
samba-cba88a2b623e47cf97885bd45387049da1105930.zip
ldb: fix the canonicalisation of booleans
we were canonicalising "FALSE" to "FALS" Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'lib/ldb')
-rw-r--r--lib/ldb/common/attrib_handlers.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/ldb/common/attrib_handlers.c b/lib/ldb/common/attrib_handlers.c
index 2f4454c7b4..73e1705593 100644
--- a/lib/ldb/common/attrib_handlers.c
+++ b/lib/ldb/common/attrib_handlers.c
@@ -166,12 +166,12 @@ static int ldb_comparison_Integer(struct ldb_context *ldb, void *mem_ctx,
static int ldb_canonicalise_Boolean(struct ldb_context *ldb, void *mem_ctx,
const struct ldb_val *in, struct ldb_val *out)
{
- if (strncasecmp((char *)in->data, "TRUE", in->length) == 0) {
+ if (in->length >= 4 && strncasecmp((char *)in->data, "TRUE", in->length) == 0) {
out->data = (uint8_t *)talloc_strdup(mem_ctx, "TRUE");
out->length = 4;
- } else if (strncasecmp((char *)in->data, "FALSE", in->length) == 0) {
+ } else if (in->length >= 5 && strncasecmp((char *)in->data, "FALSE", in->length) == 0) {
out->data = (uint8_t *)talloc_strdup(mem_ctx, "FALSE");
- out->length = 4;
+ out->length = 5;
} else {
return -1;
}