s4/libcli/raw: clang: Fix 'Dereference of null pointer'
authorNoel Power <noel.power@suse.com>
Fri, 26 Jul 2019 16:18:49 +0000 (16:18 +0000)
committerNoel Power <npower@samba.org>
Wed, 25 Sep 2019 09:47:31 +0000 (09:47 +0000)
Fixes:

source4/libcli/raw/rawfileinfo.c:597:2: warning: Dereference of null pointer <--[clang]
        SMBCLI_CHECK_WCT(req, 10);
        ^
source4/libcli/raw/rawfileinfo.c:639:2: warning: Dereference of null pointer <--[clang]
        SMBCLI_CHECK_WCT(req, 11);
        ^

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
source4/libcli/raw/rawfileinfo.c

index cbc4fbd4e8bcfb9eff96ee5899e5c28cc90c97d0..235b3cd0fa2c76bb5b3266aead2726c50b202406 100644 (file)
@@ -597,6 +597,10 @@ static struct smbcli_request *smb_raw_getattr_send(struct smbcli_tree *tree,
 static NTSTATUS smb_raw_getattr_recv(struct smbcli_request *req,
                                     union smb_fileinfo *parms)
 {
+       if (req == NULL) {
+               goto failed;
+       }
+
        if (!smbcli_request_receive(req) ||
            smbcli_request_is_error(req)) {
                return smbcli_request_destroy(req);
@@ -639,11 +643,15 @@ static struct smbcli_request *smb_raw_getattrE_send(struct smbcli_tree *tree,
 static NTSTATUS smb_raw_getattrE_recv(struct smbcli_request *req,
                                      union smb_fileinfo *parms)
 {
+       if (req == NULL) {
+               goto failed;
+       }
+
        if (!smbcli_request_receive(req) ||
            smbcli_request_is_error(req)) {
                return smbcli_request_destroy(req);
        }
-       
+
        SMBCLI_CHECK_WCT(req, 11);
        parms->getattre.out.create_time =   raw_pull_dos_date2(req->transport,
                                                               req->in.vwv + VWV(0));