nsswitch: cppcheck: Fix ctunullpointer error
authorNoel Power <noel.power@suse.com>
Thu, 23 May 2019 13:56:39 +0000 (13:56 +0000)
committerAndreas Schneider <asn@cryptomilk.org>
Tue, 4 Jun 2019 22:13:07 +0000 (22:13 +0000)
Fixes

nsswitch/pam_winbind.c:1379: error: ctunullpointer: Null pointer dereference: info <--[cppcheck]

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
nsswitch/pam_winbind.c

index 0ba1955..7841377 100644 (file)
@@ -1375,14 +1375,16 @@ static void _pam_set_data_string(struct pwb_context *ctx,
 static void _pam_set_data_info3(struct pwb_context *ctx,
                                const struct wbcAuthUserInfo *info)
 {
-       _pam_set_data_string(ctx, PAM_WINBIND_HOMEDIR,
+       if (info != NULL) {
+               _pam_set_data_string(ctx, PAM_WINBIND_HOMEDIR,
                             info->home_directory);
-       _pam_set_data_string(ctx, PAM_WINBIND_LOGONSCRIPT,
+               _pam_set_data_string(ctx, PAM_WINBIND_LOGONSCRIPT,
                             info->logon_script);
-       _pam_set_data_string(ctx, PAM_WINBIND_LOGONSERVER,
+               _pam_set_data_string(ctx, PAM_WINBIND_LOGONSERVER,
                             info->logon_server);
-       _pam_set_data_string(ctx, PAM_WINBIND_PROFILEPATH,
+               _pam_set_data_string(ctx, PAM_WINBIND_PROFILEPATH,
                             info->profile_path);
+       }
 }
 
 /**