aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2000-11-19 19:45:54 +0000
committerGerald Combs <gerald@wireshark.org>2000-11-19 19:45:54 +0000
commit0c887fd488813139e5b135968bcc98aa8acdf0ed (patch)
treebfd53266ab705ba3e8969c3c2d7098a9bceab29f
parentdb1285dce68b4f8d941e7b20521194d39c6a6f68 (diff)
downloadwireshark-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.c10
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;
}
}