Mercurial > hg > nginx
comparison src/core/ngx_resolver.c @ 4496:be6c250b827b
Fixed null pointer dereference in resolver (ticket #91).
The cycle->new_log.file may not be set before config parsing finished if
there are no error_log directive defined at global level. Fix is to
copy it after config parsing.
Patch by Roman Arutyunyan.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 27 Feb 2012 16:57:02 +0000 |
parents | 41f640a693de |
children | 95ab6658654a |
comparison
equal
deleted
inserted
replaced
4495:b4379a91f9b5 | 4496:be6c250b827b |
---|---|
187 ngx_memzero(uc, sizeof(ngx_udp_connection_t)); | 187 ngx_memzero(uc, sizeof(ngx_udp_connection_t)); |
188 | 188 |
189 uc->sockaddr = u.addrs->sockaddr; | 189 uc->sockaddr = u.addrs->sockaddr; |
190 uc->socklen = u.addrs->socklen; | 190 uc->socklen = u.addrs->socklen; |
191 uc->server = u.addrs->name; | 191 uc->server = u.addrs->name; |
192 | |
193 uc->log = cf->cycle->new_log; | |
194 uc->log.handler = ngx_resolver_log_error; | |
195 uc->log.data = uc; | |
196 uc->log.action = "resolving"; | |
197 } | 192 } |
198 | 193 |
199 return r; | 194 return r; |
200 } | 195 } |
201 | 196 |
874 if (r->last_connection == r->udp_connections.nelts) { | 869 if (r->last_connection == r->udp_connections.nelts) { |
875 r->last_connection = 0; | 870 r->last_connection = 0; |
876 } | 871 } |
877 | 872 |
878 if (uc->connection == NULL) { | 873 if (uc->connection == NULL) { |
874 | |
875 uc->log = *r->log; | |
876 uc->log.handler = ngx_resolver_log_error; | |
877 uc->log.data = uc; | |
878 uc->log.action = "resolving"; | |
879 | |
879 if (ngx_udp_connect(uc) != NGX_OK) { | 880 if (ngx_udp_connect(uc) != NGX_OK) { |
880 return NGX_ERROR; | 881 return NGX_ERROR; |
881 } | 882 } |
882 | 883 |
883 uc->connection->data = r; | 884 uc->connection->data = r; |