Don't segfault if setproctitle(3) is called with NULL initially.

The old buffer was not being initialized and a later str*() op on
it would cause a crash if it wasn't initialized by a previous
call to setproctitle(3) with an actual string.

Noticed by: Ashley Penney <ashp@unloved.org>
This commit is contained in:
Alfred Perlstein 2003-07-01 09:45:35 +00:00
parent 6b38550512
commit 9470460d7a

View File

@ -86,6 +86,7 @@ setproctitle(const char *fmt, ...)
obuf = malloc(SPT_BUFSIZE);
if (obuf == NULL)
return;
*obuf = '\0';
}
va_start(ap, fmt);