Trouble if mapping hostname with multiple address
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
nginx (Ubuntu) |
Fix Released
|
Undecided
|
Mahyuddin Susanto |
Bug Description
Binary package hint: nginx
As describe at: http://
---
In ngx_inet.c, there is a code piece of function
"ngx_inet_
this hostname map to multiple IP addresses, such as
[code]
10.37.4.92 myhost
127.0.0.1 myhost
[/code]
in /etc/hosts.
h->h_addr_list will be 2 entries before NULL. Each of them will be
converted to human readable format and assigned to u->addrs[ i ].
However, when one_addr is set, [b]u->addrs will be allocated ONLY ONE
ngx_addr_t mem.[/b] In this way, a mem crash is inevitable.
I set one_addr to 1 because I'm writing a custom module and want to
connect another server. Sadly the server is also running on the local
host with multiple IP in /etc/hosts. I want to connect the first IP
match that host name (10.37.4.92) because that server require a
non-lookback IP. I thought "one_addr" means "fetch the first found IP".
But seems I was wrong.
Besides this, I insist alloc mem with "i", but loop will h->h_addr_list
is very dangerous. Report an error is more suitable rather than leave a
time bomb.
Affected version: all versions!!!
--
$ apt-cache policy nginx
nginx:
Installed: 0.7.65-1ubuntu2
Candidate: 0.7.65-1ubuntu2
Version table:
*** 0.7.65-1ubuntu2 0
500 http://
100 /var/lib/
$ nginx -V
nginx version: nginx/0.7.65
TLS SNI support enabled
configure arguments: --conf-
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 10.04.1 LTS
Release: 10.04
Codename: lucid
Related branches
description: | updated |
Changed in nginx (Ubuntu): | |
status: | New → In Progress |
tags: | added: regression-proposed |
Changed in nginx (Ubuntu): | |
assignee: | nobody → Mahyuddin Susanto (udienz) |
tags: | removed: regression-proposed |
Just for reference, the proposed patch is taken from the mailing list, at http:// nginx.org/ pipermail/ nginx/2010- December/ 024235. html