diff options
author | Volker Lendecke <vlendec@samba.org> | 2006-11-13 10:50:55 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:15:47 -0500 |
commit | 64bab725f028ac68fe34cdb9b2efb2238b67db57 (patch) | |
tree | 0863ac3ff674f891915ff81e803e75627000420c | |
parent | 82cd90292fea984f6a1ef335bd86c1b4c6d6c684 (diff) | |
download | samba-64bab725f028ac68fe34cdb9b2efb2238b67db57.tar.gz samba-64bab725f028ac68fe34cdb9b2efb2238b67db57.tar.bz2 samba-64bab725f028ac68fe34cdb9b2efb2238b67db57.zip |
r19689: Fix a NULL dereference found by coverity (the call to strlen).
Jerry, please check this. The way I understood alpha_strcpy the last arg needs
to be the size of the target, not of the source.
Thanks,
Volker
(This used to be commit 287d68daab89c78748b90849c9782473784b6a84)
-rw-r--r-- | source3/rpc_server/srv_winreg_nt.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/source3/rpc_server/srv_winreg_nt.c b/source3/rpc_server/srv_winreg_nt.c index a892a9bb8d..1a130f19b6 100644 --- a/source3/rpc_server/srv_winreg_nt.c +++ b/source3/rpc_server/srv_winreg_nt.c @@ -689,12 +689,14 @@ WERROR _winreg_InitiateSystemShutdownEx(pipes_struct *p, uint16_t *hostname, str /* pull the message string and perform necessary sanity checks on it */ + chkmsg[0] = '\0'; + if ( message && message->name && message->name->name ) { if ( (msg = talloc_strdup(p->mem_ctx, message->name->name )) == NULL ) { return WERR_NOMEM; } + alpha_strcpy (chkmsg, msg, NULL, sizeof(chkmsg)); } - alpha_strcpy (chkmsg, msg?msg:"", NULL, strlen(msg)); fstr_sprintf(str_timeout, "%d", timeout); fstr_sprintf(r, reboot ? SHUTDOWN_R_STRING : ""); |