changeset 5682:110b50657d77

Upstream: restored workaround for "if". The 7022564a9e0e changeset made ineffective workaround from 2464ccebdb52 to avoid NULL pointer dereference with "if". It is now restored by moving the u->ssl_name initialization after the check. Found by Coverity (CID 1210408).
author Maxim Dounin <mdounin@mdounin.ru>
date Wed, 30 Apr 2014 19:16:55 +0400
parents 56ad171c3dd1
children 48c97d83ab7f
files src/http/ngx_http_upstream.c
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -584,9 +584,6 @@ ngx_http_upstream_init_request(ngx_http_
     if (u->resolved == NULL) {
 
         uscf = u->conf->upstream;
-#if (NGX_HTTP_SSL)
-        u->ssl_name = uscf->host;
-#endif
 
     } else {
 
@@ -680,6 +677,10 @@ found:
         return;
     }
 
+#if (NGX_HTTP_SSL)
+    u->ssl_name = uscf->host;
+#endif
+
     if (uscf->peer.init(r, uscf) != NGX_OK) {
         ngx_http_upstream_finalize_request(r, u,
                                            NGX_HTTP_INTERNAL_SERVER_ERROR);