[PATCH 03 of 31] Fix u->one_addr handling in ngx_inet_resolve_host()

Maxim Dounin mdounin at mdounin.ru
Tue Feb 15 16:33:19 MSK 2011


# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1297774382 -10800
# Node ID eec2f8df6cf50dc00d8544045bce5b2e45ee6382
# Parent  b9df7f61e54eed67af6ea6eca09b3f2fed991f6d
Fix u->one_addr handling in ngx_inet_resolve_host().

See report here:

http://nginx.org/pipermail/nginx/2010-December/024229.html

diff --git a/src/core/ngx_inet.c b/src/core/ngx_inet.c
--- a/src/core/ngx_inet.c
+++ b/src/core/ngx_inet.c
@@ -943,7 +943,7 @@ ngx_inet_resolve_host(ngx_pool_t *pool, 
 
         u->naddrs = i;
 
-        for (i = 0; h->h_addr_list[i] != NULL; i++) {
+        for (i = 0; i < u->naddrs; i++) {
 
             sin = ngx_pcalloc(pool, sizeof(struct sockaddr_in));
             if (sin == NULL) {



More information about the nginx-devel mailing list