diff options
author | imp <imp@FreeBSD.org> | 1998-06-09 04:31:02 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 1998-06-09 04:31:02 +0000 |
commit | 8c96be00ef748f03f9e7f9f5934e7b0d53d1c872 (patch) | |
tree | 4cac82b29697cfe595adc937f0a97621ae134760 /usr.bin/finger | |
parent | 9a6732bd4e65d3bdaeb59e6b7cd0331484e1c331 (diff) | |
download | FreeBSD-src-8c96be00ef748f03f9e7f9f5934e7b0d53d1c872.zip FreeBSD-src-8c96be00ef748f03f9e7f9f5934e7b0d53d1c872.tar.gz |
Don't assume that hp->h_lenght == 4. Be conservative in its use.
Submitted by: J. Assange a long time ago.
Diffstat (limited to 'usr.bin/finger')
-rw-r--r-- | usr.bin/finger/net.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/finger/net.c b/usr.bin/finger/net.c index 5c4b2f01..7d7b25c 100644 --- a/usr.bin/finger/net.c +++ b/usr.bin/finger/net.c @@ -39,11 +39,12 @@ static char sccsid[] = "@(#)net.c 8.4 (Berkeley) 4/28/95"; #else static const char rcsid[] = - "$Id: net.c,v 1.8 1997/07/02 06:34:50 charnier Exp $"; + "$Id: net.c,v 1.9 1997/08/01 20:10:44 wollman Exp $"; #endif #endif /* not lint */ #include <sys/types.h> +#include <sys/param.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> @@ -96,7 +97,7 @@ netfinger(name) return; } sin.sin_family = hp->h_addrtype; - bcopy(hp->h_addr, (char *)&sin.sin_addr, hp->h_length); + bcopy(hp->h_addr, (char *)&sin.sin_addr, MIN(hp->h_length,sizeof(sin.sin_addr))); sin.sin_port = sp->s_port; if ((s = socket(hp->h_addrtype, SOCK_STREAM, 0)) < 0) { perror("finger: socket"); |