diff options
author | alfred <alfred@FreeBSD.org> | 2003-07-01 09:45:35 +0000 |
---|---|---|
committer | alfred <alfred@FreeBSD.org> | 2003-07-01 09:45:35 +0000 |
commit | 503a83a7c1a1f590cd26081961544c9fbd89218d (patch) | |
tree | d54967314dcf5f85a3bded3383aef9ce097c8a6f /lib/libc | |
parent | e34fed157a2a4611a1f5a877ab4a29c0a1a567d6 (diff) | |
download | FreeBSD-src-503a83a7c1a1f590cd26081961544c9fbd89218d.zip FreeBSD-src-503a83a7c1a1f590cd26081961544c9fbd89218d.tar.gz |
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>
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/gen/setproctitle.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/libc/gen/setproctitle.c b/lib/libc/gen/setproctitle.c index 332453c..cd705fb 100644 --- a/lib/libc/gen/setproctitle.c +++ b/lib/libc/gen/setproctitle.c @@ -86,6 +86,7 @@ setproctitle(const char *fmt, ...) obuf = malloc(SPT_BUFSIZE); if (obuf == NULL) return; + *obuf = '\0'; } va_start(ap, fmt); |