From d3e5ade2dae4629ef9faa46e6b8b360edae8c8ca Mon Sep 17 00:00:00 2001 From: goldsimon Date: Mon, 17 May 2010 12:36:45 +0000 Subject: [PATCH] Correctly NULL-terminate h_addr_list --- CHANGELOG | 3 +++ src/api/netdb.c | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index b6dddc7a..6cdc05cf 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -215,6 +215,9 @@ HISTORY ++ Bugfixes: + 2010-05-17: Simon Goldschmidt + * netdb.c: Correctly NULL-terminate h_addr_list + 2010-05-16: Simon Goldschmidt * def.h/.c: changed the semantics of LWIP_PREFIX_BYTEORDER_FUNCS to prevent "symbol already defined" i.e. when linking to winsock diff --git a/src/api/netdb.c b/src/api/netdb.c index fdc55be0..a7e4e06b 100644 --- a/src/api/netdb.c +++ b/src/api/netdb.c @@ -91,7 +91,7 @@ lwip_gethostbyname(const char *name) HOSTENT_STORAGE struct hostent s_hostent; HOSTENT_STORAGE char *s_aliases; HOSTENT_STORAGE ip_addr_t s_hostent_addr; - HOSTENT_STORAGE ip_addr_t *s_phostent_addr; + HOSTENT_STORAGE ip_addr_t *s_phostent_addr[2]; /* query host IP address */ err = netconn_gethostbyname(name, &addr); @@ -103,7 +103,8 @@ lwip_gethostbyname(const char *name) /* fill hostent */ s_hostent_addr = addr; - s_phostent_addr = &s_hostent_addr; + s_phostent_addr[0] = &s_hostent_addr; + s_phostent_addr[1] = NULL; s_hostent.h_name = (char*)name; s_hostent.h_aliases = &s_aliases; s_hostent.h_addrtype = AF_INET;