diff src/http/modules/ngx_http_charset_filter_module.c @ 797:36f7b549f481

fix segfault if $server_addr failed
author Igor Sysoev <igor@sysoev.ru>
date Fri, 20 Oct 2006 19:07:50 +0000
parents 907361d07f25
children db7c468c447d
line wrap: on
line diff
--- a/src/http/modules/ngx_http_charset_filter_module.c
+++ b/src/http/modules/ngx_http_charset_filter_module.c
@@ -250,6 +250,10 @@ ngx_http_charset_header_filter(ngx_http_
                 vv = ngx_http_get_indexed_variable(r,
                                                charset - NGX_HTTP_CHARSET_VAR);
 
+                if (vv == NULL || vv->not_found) {
+                    return NGX_ERROR;
+                }
+
                 charset = ngx_http_charset_get_charset(charsets, n,
                                                        (ngx_str_t *) vv);
             }
@@ -293,6 +297,10 @@ ngx_http_charset_header_filter(ngx_http_
             vv = ngx_http_get_indexed_variable(r,
                                         source_charset - NGX_HTTP_CHARSET_VAR);
 
+            if (vv == NULL || vv->not_found) {
+                return NGX_ERROR;
+            }
+
             source_charset = ngx_http_charset_get_charset(charsets, n,
                                                           (ngx_str_t *) vv);
         }