Welcome! Log In Create A New Profile

Advanced

[nginx] svn commit: r4620 - trunk/src/core

Anonymous User
May 14, 2012 09:52AM
Author: mdounin
Date: 2012-05-14 09:13:45 +0000 (Mon, 14 May 2012)
New Revision: 4620
URL: http://trac.nginx.org/nginx/changeset/4620/nginx

Log:
Resolver: protection from duplicate responses.

If we already had CNAME in resolver node (i.e. rn->cnlen and rn->u.cname
set), and got additional response with A record, it resulted in rn->cnlen
set and rn->u.cname overwritten by rn->u.addr (or rn->u.addrs), causing
segmentation fault later in ngx_resolver_free_node() on an attempt to free
overwritten rn->u.cname. The opposite (i.e. CNAME got after A) might cause
similar problems as well.


Modified:
trunk/src/core/ngx_resolver.c

Modified: trunk/src/core/ngx_resolver.c
===================================================================
--- trunk/src/core/ngx_resolver.c 2012-05-11 13:33:06 UTC (rev 4619)
+++ trunk/src/core/ngx_resolver.c 2012-05-14 09:13:45 UTC (rev 4620)
@@ -513,8 +513,10 @@

/* lock alloc mutex */

- ngx_resolver_free_locked(r, rn->query);
- rn->query = NULL;
+ if (rn->query) {
+ ngx_resolver_free_locked(r, rn->query);
+ rn->query = NULL;
+ }

if (rn->cnlen) {
ngx_resolver_free_locked(r, rn->u.cname);
@@ -1409,6 +1411,9 @@
ngx_resolver_free(r, addrs);
}

+ ngx_resolver_free(r, rn->query);
+ rn->query = NULL;
+
return;

} else if (cname) {
@@ -1441,6 +1446,9 @@
(void) ngx_resolve_name_locked(r, ctx);
}

+ ngx_resolver_free(r, rn->query);
+ rn->query = NULL;
+
return;
}


_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] svn commit: r4620 - trunk/src/core

Anonymous User 958 May 14, 2012 09:52AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 219
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready