When get_parsed_dns() fails due to OOM, it returns NULL. Without
checking for NULL before the comparison loop, old_val and new_val
are dereferenced causing a NULL pointer dereference.
Add explicit NULL guards after both get_parsed_dns() calls and return
early if either fails when the corresponding element has values.
Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
old_values = get_parsed_dns(ctx, old_el);
new_values = get_parsed_dns(ctx, el);
+
+ if (old_num_values > 0 && old_values == NULL) {
+ DBG_ERR("Failed to parse old member DNs, skipping audit\n");
+ TALLOC_FREE(ctx);
+ return;
+ }
+ if (new_num_values > 0 && new_values == NULL) {
+ DBG_ERR("Failed to parse new member DNs, skipping audit\n");
+ TALLOC_FREE(ctx);
+ return;
+ }
+
ldb = ldb_module_get_ctx(module);
old_i = 0;