]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4:torture: Initialize pointer with NULL
authorAndreas Schneider <asn@samba.org>
Tue, 2 Jul 2024 09:37:25 +0000 (11:37 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Mon, 8 Jul 2024 07:36:33 +0000 (07:36 +0000)
"Error: UNINIT (CWE-457):
samba-4.20.0rc2/source4/torture/rpc/samsync.c:342: var_decl: Declaring variable ""dom_sid"" without initializer.
samba-4.20.0rc2/source4/torture/rpc/samsync.c:385: uninit_use_in_call: Using uninitialized value ""dom_sid"" when calling ""dom_sid_dup"".
  383|    }
  384|    if (samsync_state->domain_handle[database_id]) {
  385|->  samsync_state->sid[database_id] = dom_sid_dup(samsync_state, dom_sid);
  386|    }
  387|"

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source4/torture/rpc/samsync.c

index a8541d3464170f5ba9e16b6ad5bfbe6a7b9f4d3f..9111df9feed055716483ec31e1d18d785cd18382 100644 (file)
@@ -339,7 +339,7 @@ static bool samsync_handle_domain(struct torture_context *tctx, TALLOC_CTX *mem_
                           int database_id, struct netr_DELTA_ENUM *delta)
 {
        struct netr_DELTA_DOMAIN *domain = delta->delta_union.domain;
-       struct dom_sid *dom_sid;
+       struct dom_sid *dom_sid = NULL;
        struct samr_QueryDomainInfo q[14]; /* q[0] will be unused simple for clarity */
        union samr_DomainInfo *info[14];
        uint16_t levels[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13};