From 432024ed47d536d7a58e2003e3449874e17001ef Mon Sep 17 00:00:00 2001 From: Matthias Wachs Date: Mon, 2 Sep 2013 10:01:43 +0000 Subject: [PATCH] h_addr is a define in in netdb.h leads to stack corruption -> rename variable --- src/transport/plugin_transport_http_server.c | 54 ++++++++++---------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c index abf3fdacd..d102880eb 100644 --- a/src/transport/plugin_transport_http_server.c +++ b/src/transport/plugin_transport_http_server.c @@ -654,35 +654,33 @@ static int http_server_plugin_address_suggested (void *cls, const void *addr, size_t addrlen) { - struct HttpAddressWrapper *next; - struct HttpAddressWrapper *pos; - struct HttpAddress *h_addr; - h_addr = (struct HttpAddress *) addr; - - if ((NULL != p->ext_addr) && - GNUNET_YES == (http_common_cmp_addresses (addr, addrlen, - p->ext_addr, p->ext_addr_len))) - { - /* Checking HTTP_OPTIONS_VERIFY_CERTIFICATE option for external hostname */ - if ((ntohl(h_addr->options) & HTTP_OPTIONS_VERIFY_CERTIFICATE) != - (p->options & HTTP_OPTIONS_VERIFY_CERTIFICATE)) + struct HttpAddressWrapper *next; + struct HttpAddressWrapper *pos; + const struct HttpAddress *haddr = addr; + + if ((NULL != p->ext_addr) && + GNUNET_YES == (http_common_cmp_addresses (addr, addrlen, + p->ext_addr, p->ext_addr_len))) + { + /* Checking HTTP_OPTIONS_VERIFY_CERTIFICATE option for external hostname */ + if ((ntohl(haddr->options) & HTTP_OPTIONS_VERIFY_CERTIFICATE) != + (p->options & HTTP_OPTIONS_VERIFY_CERTIFICATE)) return GNUNET_NO; /* VERIFY option not set as required! */ - return GNUNET_OK; - } - - next = p->addr_head; - while (NULL != (pos = next)) - { - next = pos->next; - if (GNUNET_YES == (http_common_cmp_addresses(addr, - addrlen, - pos->address, - pos->addrlen))) - return GNUNET_OK; - - } - - return GNUNET_NO; + return GNUNET_OK; + } + + next = p->addr_head; + while (NULL != (pos = next)) + { + next = pos->next; + if (GNUNET_YES == (http_common_cmp_addresses(addr, + addrlen, + pos->address, + pos->addrlen))) + return GNUNET_OK; + + } + return GNUNET_NO; } -- 2.25.1