From 8c96be00ef748f03f9e7f9f5934e7b0d53d1c872 Mon Sep 17 00:00:00 2001 From: imp Date: Tue, 9 Jun 1998 04:31:02 +0000 Subject: Don't assume that hp->h_lenght == 4. Be conservative in its use. Submitted by: J. Assange a long time ago. --- usr.bin/finger/net.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'usr.bin/finger') 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 +#include #include #include #include @@ -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"); -- cgit v1.1