]> git.kaiwu.me - nginx.git/commitdiff
Fixed ETag memory allocation error handling.
authorMaxim Dounin <mdounin@mdounin.ru>
Mon, 8 Sep 2014 17:36:03 +0000 (21:36 +0400)
committerMaxim Dounin <mdounin@mdounin.ru>
Mon, 8 Sep 2014 17:36:03 +0000 (21:36 +0400)
The etag->hash must be set to 0 to avoid an empty ETag header being
returned with the 500 Internal Server Error page after the memory
allocation failure.

Reported by Markus Linnala.

src/http/ngx_http_core_module.c

index 4071b612649a1f213d1e3eb281671e69bdd20402..3b36f4a1920ee459f8665766e56a007f45690434 100644 (file)
@@ -1837,6 +1837,7 @@ ngx_http_set_etag(ngx_http_request_t *r)
 
     etag->value.data = ngx_pnalloc(r->pool, NGX_OFF_T_LEN + NGX_TIME_T_LEN + 3);
     if (etag->value.data == NULL) {
+        etag->hash = 0;
         return NGX_ERROR;
     }