libcli/smb: clang: Fix 'Dereference of null pointer'
authorNoel Power <noel.power@suse.com>
Wed, 10 Jul 2019 10:41:29 +0000 (10:41 +0000)
committerGary Lockyer <gary@samba.org>
Tue, 16 Jul 2019 22:52:25 +0000 (22:52 +0000)
Fixes:

smbXcli_base.c:4885:20: warning: Dereference of null pointer <--[clang]
        body = (uint8_t *)iov[1].iov_base;
                          ^~~~~~~~~~~~~~~

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
libcli/smb/smbXcli_base.c

index b0e8aabb72e7b70235a078b73c637da1f197ea41..0e45fd9836eb2543721939d5bc4dd45a2f4ad9bf 100644 (file)
@@ -4851,7 +4851,7 @@ static void smbXcli_negprot_smb2_done(struct tevent_req *subreq)
        size_t security_offset, security_length;
        DATA_BLOB blob;
        NTSTATUS status;
-       struct iovec *iov;
+       struct iovec *iov = NULL;
        uint8_t *body;
        size_t i;
        uint16_t dialect_revision;
@@ -4879,7 +4879,7 @@ static void smbXcli_negprot_smb2_done(struct tevent_req *subreq)
 
        status = smb2cli_req_recv(subreq, state, &iov,
                                  expected, ARRAY_SIZE(expected));
-       if (tevent_req_nterror(req, status)) {
+       if (tevent_req_nterror(req, status) || iov == NULL) {
                return;
        }