Use ldb_dn_from_ldb_val to avoid possible over-run of the value.
[abartlet/samba.git/.git] / source4 / lib / ldb / ldb_map / ldb_map.c
index fafbb63b0a7c55ca8ebd2818555f68c5985afe1a..72d8378a076c14f489c1e3c04cb8adb1f808c164 100644 (file)
@@ -626,7 +626,7 @@ static struct ldb_val ldb_dn_convert_local(struct ldb_module *module, void *mem_
        struct ldb_dn *dn, *newdn;
        struct ldb_val newval;
 
-       dn = ldb_dn_new(mem_ctx, module->ldb, (char *)val->data);
+       dn = ldb_dn_from_ldb_val(mem_ctx, module->ldb, val);
        if (! ldb_dn_validate(dn)) {
                newval.length = 0;
                newval.data = NULL;
@@ -652,7 +652,7 @@ static struct ldb_val ldb_dn_convert_remote(struct ldb_module *module, void *mem
        struct ldb_dn *dn, *newdn;
        struct ldb_val newval;
 
-       dn = ldb_dn_new(mem_ctx, module->ldb, (char *)val->data);
+       dn = ldb_dn_from_ldb_val(mem_ctx, module->ldb, val);
        if (! ldb_dn_validate(dn)) {
                newval.length = 0;
                newval.data = NULL;