r14115: Fix coverity bug #23. Don't deref a potentially null ptr.
authorJeremy Allison <jra@samba.org>
Thu, 9 Mar 2006 22:46:42 +0000 (22:46 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:11:13 +0000 (11:11 -0500)
Jeremy.

source/rpc_parse/parse_samr.c

index 043bafe28530f2f8cd37228f5977bd716386d3dd..2f8fe74ed3a3ef2a97aa84e092066886b9108c10 100644 (file)
@@ -5541,7 +5541,11 @@ void init_sam_user_info23W(SAM_USER_INFO_23 * usr, NTTIME * logon_time,  /* all z
        copy_unistr2(&usr->uni_munged_dial, mung_dial);
        init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial);
 
-       memcpy(&usr->logon_hrs, hrs, sizeof(usr->logon_hrs));
+       if (hrs) {
+               memcpy(&usr->logon_hrs, hrs, sizeof(usr->logon_hrs));
+       } else {
+               ZERO_STRUCT(usr->logon_hrs);
+       }
 }
 
 /*************************************************************************