diff options
| author | Maxim Dounin <mdounin@mdounin.ru> | 2012-09-24 19:06:48 +0000 |
|---|---|---|
| committer | Maxim Dounin <mdounin@mdounin.ru> | 2012-09-24 19:06:48 +0000 |
| commit | 21ccde77f5b632fc1d780d4533a7efa5be69fe9d (patch) | |
| tree | 230b216b35f2cee22ce84f34c8d69ab62048dbf9 /src/http/ngx_http_core_module.c | |
| parent | adceda60bde1882fb89a2d7e3c62b93e9337ed5e (diff) | |
| download | nginx-21ccde77f5b632fc1d780d4533a7efa5be69fe9d.tar.gz nginx-21ccde77f5b632fc1d780d4533a7efa5be69fe9d.tar.bz2 | |
Merge of r4829: fixed strict aliasing with ipv6 (ticket #201).
Fixed strict aliasing bugs when dealing with IPv4-mapped IPv6
addresses.
Diffstat (limited to 'src/http/ngx_http_core_module.c')
| -rw-r--r-- | src/http/ngx_http_core_module.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c index e0cf4a0fb..e02a251c3 100644 --- a/src/http/ngx_http_core_module.c +++ b/src/http/ngx_http_core_module.c @@ -2733,7 +2733,15 @@ ngx_http_get_forwarded_addr(ngx_http_request_t *r, ngx_addr_t *addr, if (IN6_IS_ADDR_V4MAPPED(inaddr6)) { family = AF_INET; - inaddr = *(in_addr_t *) &inaddr6->s6_addr[12]; + + p = inaddr6->s6_addr; + + inaddr = p[12] << 24; + inaddr += p[13] << 16; + inaddr += p[14] << 8; + inaddr += p[15]; + + inaddr = htonl(inaddr); } } #endif |
