Be extra paranoid about trusting the size of the address returned from
gethostbyaddr. Submitted by: Julian Assange
This commit is contained in:
parent
6fefd43684
commit
9ae323c5f0
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=31954
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user