From: Andrew Tridgell Date: Tue, 9 Aug 2011 06:41:16 +0000 (+1000) Subject: ldb: fix the canonicalisation of booleans X-Git-Url: http://git.samba.org/?p=metze%2Fsamba%2Fwip.git;a=commitdiff_plain;h=cba88a2b623e47cf97885bd45387049da1105930 ldb: fix the canonicalisation of booleans we were canonicalising "FALSE" to "FALS" Pair-Programmed-With: Andrew Bartlett --- diff --git a/lib/ldb/common/attrib_handlers.c b/lib/ldb/common/attrib_handlers.c index 2f4454c7b41e..73e1705593bf 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; }