diff options
author | 1998-06-23 22:40:25 +0000 | |
---|---|---|
committer | 1998-06-23 22:40:25 +0000 | |
commit | 57d1eca611bcc163b7a08993a5f2056db4e10be7 (patch) | |
tree | a2b1cb62ca7d64f5fe1e7c6dd355dc78712fc3bb /lib/libc/gen/setproctitle.c | |
parent | bye bye contrib (diff) | |
download | wireguard-openbsd-57d1eca611bcc163b7a08993a5f2056db4e10be7.tar.xz wireguard-openbsd-57d1eca611bcc163b7a08993a5f2056db4e10be7.zip |
Fix snprintf return value usage.
Diffstat (limited to 'lib/libc/gen/setproctitle.c')
-rw-r--r-- | lib/libc/gen/setproctitle.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libc/gen/setproctitle.c b/lib/libc/gen/setproctitle.c index 731c621461c..765cdeae056 100644 --- a/lib/libc/gen/setproctitle.c +++ b/lib/libc/gen/setproctitle.c @@ -30,7 +30,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: setproctitle.c,v 1.5 1997/07/25 20:30:03 mickey Exp $"; +static char rcsid[] = "$OpenBSD: setproctitle.c,v 1.6 1998/06/23 22:40:27 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> @@ -66,7 +66,7 @@ setproctitle(fmt, va_alist) va_list ap; static char buf[MAX_PROCTITLE], *bufp = buf; - int used; + size_t used; #ifdef __STDC__ va_start(ap, fmt); @@ -75,6 +75,8 @@ setproctitle(fmt, va_alist) #endif if (fmt != NULL) { used = snprintf(buf, MAX_PROCTITLE, "%s: ", __progname); + if (used >= MAX_PROCTITLE) + used = MAX_PROCTITLE - 1; (void)vsnprintf(buf + used, MAX_PROCTITLE - used, fmt, ap); } else (void)snprintf(buf, MAX_PROCTITLE, "%s", __progname); |