1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-08 04:58:40 +03:00

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)
This commit is contained in:
Volker Lendecke 2006-11-13 10:50:55 +00:00 committed by Gerald (Jerry) Carter
parent 82cd90292f
commit 64bab725f0

View File

@ -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 : "");