summaryrefslogtreecommitdiff
path: root/lib/libc/gen
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/gen')
-rw-r--r--lib/libc/gen/getbsize.c4
-rw-r--r--lib/libc/gen/setproctitle.c6
2 files changed, 7 insertions, 3 deletions
diff --git a/lib/libc/gen/getbsize.c b/lib/libc/gen/getbsize.c
index f3fbece28ff..9ecff68119c 100644
--- a/lib/libc/gen/getbsize.c
+++ b/lib/libc/gen/getbsize.c
@@ -32,7 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: getbsize.c,v 1.5 1997/08/24 21:25:45 millert Exp $";
+static char rcsid[] = "$OpenBSD: getbsize.c,v 1.6 1998/06/23 22:40:25 millert Exp $";
#endif /* not lint */
#include <err.h>
@@ -101,6 +101,8 @@ underflow: _warnx("%s: minimum blocksize is 512", p);
blocksize = n = 512;
*headerlenp = snprintf(header, sizeof(header), "%ld%s-blocks", n, form);
+ if (*headerlenp >= sizeof(header))
+ *headerlenp = sizeof(header) - 1;
*blocksizep = blocksize;
return (header);
}
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);