diff options
author | Gerald Combs <gerald@wireshark.org> | 2000-11-19 19:45:54 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2000-11-19 19:45:54 +0000 |
commit | 0c887fd488813139e5b135968bcc98aa8acdf0ed (patch) | |
tree | bfd53266ab705ba3e8969c3c2d7098a9bceab29f | |
parent | db1285dce68b4f8d941e7b20521194d39c6a6f68 (diff) | |
download | wireshark-0c887fd488813139e5b135968bcc98aa8acdf0ed.tar.gz wireshark-0c887fd488813139e5b135968bcc98aa8acdf0ed.tar.bz2 wireshark-0c887fd488813139e5b135968bcc98aa8acdf0ed.zip |
Check to make sure the h_addr entry returned by gethostbyname() can fit
into an in_addr struct.
svn path=/trunk/; revision=2673
-rw-r--r-- | epan/resolv.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/epan/resolv.c b/epan/resolv.c index 83996798a5..5838da0245 100644 --- a/epan/resolv.c +++ b/epan/resolv.c @@ -1,7 +1,7 @@ /* resolv.c * Routines for network object lookup * - * $Id: resolv.c,v 1.3 2000/10/19 22:59:24 guy Exp $ + * $Id: resolv.c,v 1.4 2000/11/19 19:45:54 gerald Exp $ * * Laurent Deniel <deniel@worldnet.fr> * @@ -1351,10 +1351,12 @@ gboolean get_host_ipaddr(const char *host, guint32 *addrp) if (hp == NULL) { /* No. */ return FALSE; - } else { - /* XXX - is "hp->h_length" the size of a - * "struct in_addr"? It should be. */ + /* Apparently, some versions of gethostbyaddr can + * return IPv6 addresses. */ + } else if (hp->h_length <= sizeof (struct in_addr)) { memcpy(&ipaddr, hp->h_addr, hp->h_length); + } else { + return FALSE; } } |