diff options
author | guido <guido@FreeBSD.org> | 1997-01-01 14:08:47 +0000 |
---|---|---|
committer | guido <guido@FreeBSD.org> | 1997-01-01 14:08:47 +0000 |
commit | 07e783bc3eb2bb61a692e734cf205be502266408 (patch) | |
tree | 9d2e2a69b3a8d19bb2eb7f63181668f968c36e59 /sbin/restore/tape.c | |
parent | 01876569b2445fed76ab3d84c1704e73ad519d13 (diff) | |
download | FreeBSD-src-07e783bc3eb2bb61a692e734cf205be502266408.zip FreeBSD-src-07e783bc3eb2bb61a692e734cf205be502266408.tar.gz |
Yet another buffer overflow.
2.2 candidate
(and -stable too actually, who does that?)
Reviewed by: Warner Losh
Diffstat (limited to 'sbin/restore/tape.c')
-rw-r--r-- | sbin/restore/tape.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sbin/restore/tape.c b/sbin/restore/tape.c index 7aae76d..51a1ac5 100644 --- a/sbin/restore/tape.c +++ b/sbin/restore/tape.c @@ -63,7 +63,7 @@ static char sccsid[] = "@(#)tape.c 8.3 (Berkeley) 4/1/94"; static long fssize = MAXBSIZE; static int mt = -1; static int pipein = 0; -static char magtape[BUFSIZ]; +static char *magtape; static int blkcnt; static int numtrec; static char *tapebuf; @@ -146,7 +146,11 @@ setinput(source) pipein++; } setuid(getuid()); /* no longer need or want root privileges */ - (void) strcpy(magtape, source); + magtape = strdup(source); + if (magtape == NULL) { + fprintf(stderr, "Cannot allocate space for magtape buffer\n"); + done(1); + } } void |