]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
rpc/dnsdata: do not crash if message attr missing (CID: 1414773)
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Thu, 2 May 2019 21:46:04 +0000 (09:46 +1200)
committerDouglas Bagnall <dbagnall@samba.org>
Thu, 9 May 2019 22:39:27 +0000 (22:39 +0000)
This should be hard to trigger, but goto fail is always nicer than sig 11.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
source4/rpc_server/dnsserver/dnsdata.c

index 59e29f029a675dafa018d9eaec59a4dd4e84e16a..6a211ad9efdfefc2d0ec5e41e779c037bca1822b 100644 (file)
@@ -794,6 +794,11 @@ struct dns_tree *dns_build_tree(TALLOC_CTX *mem_ctx, const char *name, struct ld
        /* Add all names in the result in a tree */
        for (i=0; i<res->count; i++) {
                ptr = ldb_msg_find_attr_as_string(res->msgs[i], "name", NULL);
+               if (ptr == NULL) {
+                       DBG_ERR("dnsserver: dns record has no name (%s)",
+                               ldb_dn_get_linearized(res->msgs[i]->dn));
+                       goto failed;
+               }
 
                if (strcmp(ptr, "@") == 0) {
                        base->data = res->msgs[i];