diff options
author | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 1999-08-26 09:04:01 +0000 |
---|---|---|
committer | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 1999-08-26 09:04:01 +0000 |
commit | d0177f85c4c6aa4deb3501f228fafdccc95f0b95 (patch) | |
tree | 5bbf8d570cd4c01fb2abafecdd879ca9b551a744 /usr.bin/ar/misc.c | |
parent | 23f45398942149118aff3e5f9693c416e5e0db19 (diff) |
Fix a buf oflow noticed by aazubel@cnba.uba.ar.
Change strcpy to strlcpy and use 10 X's in _NAME_ARTMP
and _PATH_ARTMP; ok millert@
Diffstat (limited to 'usr.bin/ar/misc.c')
-rw-r--r-- | usr.bin/ar/misc.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.bin/ar/misc.c b/usr.bin/ar/misc.c index 65e71d46bdd..215f944a207 100644 --- a/usr.bin/ar/misc.c +++ b/usr.bin/ar/misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.c,v 1.3 1997/09/11 11:24:54 deraadt Exp $ */ +/* $OpenBSD: misc.c,v 1.4 1999/08/26 09:04:00 fgsch Exp $ */ /* $NetBSD: misc.c,v 1.6 1995/03/26 03:27:55 glass Exp $ */ /*- @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)misc.c 8.3 (Berkeley) 4/2/94"; #else -static char rcsid[] = "$OpenBSD: misc.c,v 1.3 1997/09/11 11:24:54 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: misc.c,v 1.4 1999/08/26 09:04:00 fgsch Exp $"; #endif #endif /* not lint */ @@ -77,9 +77,10 @@ tmp() } if (envtmp) - (void)sprintf(path, "%s/%s", envtmp, _NAME_ARTMP); + (void)snprintf(path, sizeof(path), "%s/%s", envtmp, + _NAME_ARTMP); else - strcpy(path, _PATH_ARTMP); + strlcpy(path, _PATH_ARTMP, sizeof(path)); sigfillset(&set); (void)sigprocmask(SIG_BLOCK, &set, &oset); |