From eba6461a0360d1811fb9e58dbfe4ab0e3658ccbd Mon Sep 17 00:00:00 2001 From: imp Date: Tue, 7 Jan 1997 20:48:24 +0000 Subject: Fix many buffer overflows, correct usage of strcat and implement $TAPE. Inspired by OpenBSD's work in this area. Reviewed by: Peter Wemm, Guido van Rooij and Jordan Hubbard. Obtained from: OpenBSD --- sbin/dump/optr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sbin/dump/optr.c') diff --git a/sbin/dump/optr.c b/sbin/dump/optr.c index 3c464e4..60a6796 100644 --- a/sbin/dump/optr.c +++ b/sbin/dump/optr.c @@ -244,13 +244,13 @@ static void sendmes(tty, message) char *tty, *message; { - char t[50], buf[BUFSIZ]; + char t[MAXPATHLEN], buf[BUFSIZ]; register char *cp; int lmsg = 1; FILE *f_tty; (void) strcpy(t, _PATH_DEV); - (void) strcat(t, tty); + (void) strncat(t, tty, sizeof t - strlen(_PATH_DEV) - 1); if ((f_tty = fopen(t, "w")) != NULL) { setbuf(f_tty, buf); -- cgit v1.1