From dcec6574b8b4ee118bdffbbbf6bf5a555853cb64 Mon Sep 17 00:00:00 2001 From: Maxim Dounin Date: Sun, 10 Feb 2013 02:56:03 +0000 Subject: [PATCH] Merge of r4945, r4984: ngx_inet.[ch] minor fixes. *) Fixed the NGX_SOCKADDR_STRLEN macro definition. The ngx_sock_ntop() function, when told to print both address and port, prints IPv6 address in square brackets, followed by colon and port. *) Properly initialize "struct in6_addr" with zeroes. --- src/core/ngx_inet.c | 2 +- src/core/ngx_inet.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/ngx_inet.c b/src/core/ngx_inet.c index 3db0136e5..a4acc8ca5 100644 --- a/src/core/ngx_inet.c +++ b/src/core/ngx_inet.c @@ -465,7 +465,7 @@ ngx_parse_addr(ngx_pool_t *pool, ngx_addr_t *addr, u_char *text, size_t len) * prevent MSVC8 warning: * potentially uninitialized local variable 'inaddr6' used */ - ngx_memzero(inaddr6.s6_addr, sizeof(struct in6_addr)); + ngx_memzero(&inaddr6, sizeof(struct in6_addr)); #endif inaddr = ngx_inet_addr(text, len); diff --git a/src/core/ngx_inet.h b/src/core/ngx_inet.h index c5a3d7677..e30dcb511 100644 --- a/src/core/ngx_inet.h +++ b/src/core/ngx_inet.h @@ -30,7 +30,7 @@ #if (NGX_HAVE_UNIX_DOMAIN) #define NGX_SOCKADDR_STRLEN (sizeof("unix:") - 1 + NGX_UNIX_ADDRSTRLEN) #else -#define NGX_SOCKADDR_STRLEN (NGX_INET6_ADDRSTRLEN + sizeof(":65535") - 1) +#define NGX_SOCKADDR_STRLEN (NGX_INET6_ADDRSTRLEN + sizeof("[]:65535") - 1) #endif #if (NGX_HAVE_UNIX_DOMAIN)