]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:libsmb: Fix invalid array dereference
authorJo Sutton <josutton@catalyst.net.nz>
Tue, 30 Jul 2024 03:42:32 +0000 (15:42 +1200)
committerDouglas Bagnall <dbagnall@samba.org>
Sun, 4 Aug 2024 00:32:39 +0000 (00:32 +0000)
If ‘num_addrs’ is equal to zero, name_queries_send() will pass an
invalid address to name_query_send().

Signed-off-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
source3/libsmb/namequery.c

index 9a47f034d385418563efbd5cd02dbd209a8092bf..48210d92847d75b065a1e6f630b654fac38f711b 100644 (file)
@@ -1701,6 +1701,10 @@ static struct tevent_req *name_queries_send(
        struct tevent_req *req, *subreq;
        struct name_queries_state *state;
 
+       if (num_addrs == 0) {
+               return NULL;
+       }
+
        req = tevent_req_create(mem_ctx, &state,
                                struct name_queries_state);
        if (req == NULL) {