diff options
author | imp <imp@FreeBSD.org> | 1997-12-24 00:57:41 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 1997-12-24 00:57:41 +0000 |
commit | fb787b8d6adfec597d90e7b3d696fcbdedb5ab07 (patch) | |
tree | 55727980f9e05dbde02adb7c1a11a7aa0431a478 | |
parent | 24138e024fe13d912a174a8e0e784bf1a1e0a29d (diff) | |
download | FreeBSD-src-fb787b8d6adfec597d90e7b3d696fcbdedb5ab07.zip FreeBSD-src-fb787b8d6adfec597d90e7b3d696fcbdedb5ab07.tar.gz |
Be extra paranoid about trusting the size of the address returned from
gethostbyaddr.
Submitted by: Julian Assange
-rw-r--r-- | sbin/ifconfig/ifconfig.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index 900db40..d216cd5 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -42,7 +42,7 @@ static const char copyright[] = static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94"; */ static const char rcsid[] = - "$Id: ifconfig.c,v 1.31 1997/10/16 03:55:28 peter Exp $"; + "$Id: ifconfig.c,v 1.32 1997/10/27 03:28:44 steve Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -1035,7 +1035,7 @@ in_getaddr(s, which) if (inet_aton(s, &sin->sin_addr)) return; if ((hp = gethostbyname(s)) != 0) - 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))); else if ((np = getnetbyname(s)) != 0) sin->sin_addr = inet_makeaddr(np->n_net, INADDR_ANY); else |