1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

ldb: fix the canonicalisation of booleans

we were canonicalising "FALSE" to "FALS"

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Andrew Tridgell 2011-08-09 16:41:16 +10:00 committed by Andrew Bartlett
parent 60b6b338f7
commit cba88a2b62

View File

@ -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;
}