s4/libcli/raw: clang: Fix 'Access to field results in a deref of a null ptr
authorNoel Power <noel.power@suse.com>
Fri, 26 Jul 2019 15:06:54 +0000 (15:06 +0000)
committerNoel Power <npower@samba.org>
Wed, 25 Sep 2019 09:47:31 +0000 (09:47 +0000)
Fixes:

source4/libcli/raw/rawfileinfo.c:301:56: warning: Access to field 'transport' results in a dereference of a null pointer (loaded from variable 'session') <--[clang]
    parms->standard.out.create_time = raw_pull_dos_date2(session->transport,
                                                                         ^
source4/libcli/raw/rawfileinfo.c:314:55: warning: Access to field 'transport' results in a dereference of a null pointer (loaded from variable 'session') <--[clang]
    parms->ea_size.out.create_time = raw_pull_dos_date2(session->transport,

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

index a2599085ab7767041a13422d8af1546eca52fb09..cbc4fbd4e8bcfb9eff96ee5899e5c28cc90c97d0 100644 (file)
@@ -297,6 +297,10 @@ static NTSTATUS smb_raw_info_backend(struct smbcli_session *session,
                return NT_STATUS_INVALID_LEVEL;
 
        case RAW_FILEINFO_STANDARD:
+               if (session == NULL) {
+                       return NT_STATUS_INVALID_PARAMETER;
+               }
+
                FINFO_CHECK_SIZE(22);
                parms->standard.out.create_time = raw_pull_dos_date2(session->transport,
                                                                     blob->data +  0);
@@ -310,6 +314,10 @@ static NTSTATUS smb_raw_info_backend(struct smbcli_session *session,
                return NT_STATUS_OK;
 
        case RAW_FILEINFO_EA_SIZE:
+               if (session == NULL) {
+                       return NT_STATUS_INVALID_PARAMETER;
+               }
+
                FINFO_CHECK_SIZE(26);
                parms->ea_size.out.create_time = raw_pull_dos_date2(session->transport,
                                                                    blob->data +  0);