From 4e2b4be9d3bd406a303b74c8d5ebd56714a337ae Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 7 Nov 2009 12:06:11 +1100 Subject: s4:dsdb Ensure we allow 'odd' lengths for DN+String (Found in a code review by metze) Andrew Bartlett --- source4/dsdb/common/dsdb_dn.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source4') diff --git a/source4/dsdb/common/dsdb_dn.c b/source4/dsdb/common/dsdb_dn.c index 3605a6a056..6c20d09910 100644 --- a/source4/dsdb/common/dsdb_dn.c +++ b/source4/dsdb/common/dsdb_dn.c @@ -149,11 +149,6 @@ struct dsdb_dn *dsdb_dn_parse(TALLOC_CTX *mem_ctx, struct ldb_context *ldb, p1 = p2+1; len--; - if ((blen % 2 != 0)) { - DEBUG(10, (__location__ ": blen=%u - not an even number\n", (unsigned)blen)); - goto failed; - } - if (blen >= len) { DEBUG(10, (__location__ ": blen=%u len=%u\n", (unsigned)blen, (unsigned)len)); goto failed; @@ -169,6 +164,11 @@ struct dsdb_dn *dsdb_dn_parse(TALLOC_CTX *mem_ctx, struct ldb_context *ldb, switch (dn_format) { case DSDB_BINARY_DN: + if ((blen % 2 != 0)) { + DEBUG(10, (__location__ ": blen=%u - not an even number\n", (unsigned)blen)); + goto failed; + } + if (blen >= 2) { bval.length = (blen/2)+1; bval.data = talloc_size(tmp_ctx, bval.length); -- cgit