diff options
author | 1996-08-16 23:31:00 +0000 | |
---|---|---|
committer | 1996-08-16 23:31:00 +0000 | |
commit | 7808ddd90c385418ac36cdd4803470920b72a9d5 (patch) | |
tree | f3756845f27d2f69e4d1fb12974514ef652fdc02 | |
parent | buf oflow; from dholland@hcs.harvard.edu (diff) | |
download | wireguard-openbsd-7808ddd90c385418ac36cdd4803470920b72a9d5.tar.xz wireguard-openbsd-7808ddd90c385418ac36cdd4803470920b72a9d5.zip |
crank hostname length, fix one oflow; pointed out by dholland@hcs.harvard.edu
-rw-r--r-- | usr.bin/tftp/main.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.bin/tftp/main.c b/usr.bin/tftp/main.c index c27ca9cdc60..1c484c0fd45 100644 --- a/usr.bin/tftp/main.c +++ b/usr.bin/tftp/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.2 1996/06/26 05:40:34 deraadt Exp $ */ +/* $OpenBSD: main.c,v 1.3 1996/08/16 23:31:00 deraadt Exp $ */ /* $NetBSD: main.c,v 1.6 1995/05/21 16:54:10 mycroft Exp $ */ /* @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: main.c,v 1.2 1996/06/26 05:40:34 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: main.c,v 1.3 1996/08/16 23:31:00 deraadt Exp $"; #endif /* not lint */ /* Many bug fixes are from Jim Guyton <guyton@rand-unix> */ @@ -190,7 +190,7 @@ main(argc, argv) command(); } -char hostname[100]; +char hostname[MAXHOSTNAMELEN]; void setpeer(argc, argv) @@ -213,7 +213,8 @@ setpeer(argc, argv) } if (inet_aton(argv[1], &peeraddr.sin_addr) != 0) { peeraddr.sin_family = AF_INET; - (void) strcpy(hostname, argv[1]); + (void) strncpy(hostname, argv[1], sizeof hostname); + hostname[sizeof(hostname)-1] = '\0'; } else { host = gethostbyname(argv[1]); if (host == 0) { |