diff options
-rw-r--r-- | source4/lib/ldb/common/ldb_dn.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/source4/lib/ldb/common/ldb_dn.c b/source4/lib/ldb/common/ldb_dn.c index af00ef96f3..12a513fc42 100644 --- a/source4/lib/ldb/common/ldb_dn.c +++ b/source4/lib/ldb/common/ldb_dn.c @@ -88,6 +88,12 @@ struct ldb_dn *ldb_dn_from_ldb_val(void *mem_ctx, if (! ldb) return NULL; + if (strdn && strdn->data + && (strlen((const char*)strdn->data) != strdn->length)) { + /* The RDN must not contain a character with value 0x0 */ + return NULL; + } + dn = talloc_zero(mem_ctx, struct ldb_dn); LDB_DN_NULL_FAILED(dn); @@ -103,11 +109,6 @@ struct ldb_dn *ldb_dn_from_ldb_val(void *mem_ctx, dn->ext_linearized = talloc_strndup(dn, data, length); LDB_DN_NULL_FAILED(dn->ext_linearized); - if (strlen(data) != length) { - /* The RDN must not contain a character with value 0x0 */ - return NULL; - } - if (data[0] == '<') { const char *p_save, *p = dn->ext_linearized; do { |