diff src/core/ngx_resolver.c @ 640:97a1e05203c2 NGINX_1_0_10

nginx 1.0.10 *) Bugfix: a segmentation fault might occur in a worker process if resolver got a big DNS response. Thanks to Ben Hawkes. *) Bugfix: in cache key calculation if internal MD5 implementation was used; the bug had appeared in 1.0.4. *) Bugfix: the module ngx_http_mp4_module sent incorrect "Content-Length" response header line if the "start" argument was used. Thanks to Piotr Sikora.
author Igor Sysoev <http://sysoev.ru>
date Tue, 15 Nov 2011 00:00:00 +0400
parents 8dc007eddbcf
children ad25218fd14b
line wrap: on
line diff
--- a/src/core/ngx_resolver.c
+++ b/src/core/ngx_resolver.c
@@ -1922,7 +1922,13 @@ done:
     n = *src++;
 
     for ( ;; ) {
-        if (n != 0xc0) {
+        if (n & 0xc0) {
+            n = ((n & 0x3f) << 8) + *src;
+            src = &buf[n];
+
+            n = *src++;
+
+        } else {
             ngx_memcpy(dst, src, n);
             dst += n;
             src += n;
@@ -1932,12 +1938,6 @@ done:
             if (n != 0) {
                 *dst++ = '.';
             }
-
-        } else {
-            n = ((n & 0x3f) << 8) + *src;
-            src = &buf[n];
-
-            n = *src++;
         }
 
         if (n == 0) {