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:
parent
6b38550512
commit
9470460d7a
@ -86,6 +86,7 @@ setproctitle(const char *fmt, ...)
|
||||
obuf = malloc(SPT_BUFSIZE);
|
||||
if (obuf == NULL)
|
||||
return;
|
||||
*obuf = '\0';
|
||||
}
|
||||
|
||||
va_start(ap, fmt);
|
||||
|
Loading…
Reference in New Issue
Block a user