From 90df702bf86e4d9a9a2f319743598bc7aa1f8f57 Mon Sep 17 00:00:00 2001 From: Maxim Dounin Date: Mon, 8 Sep 2014 21:36:03 +0400 Subject: [PATCH] Fixed ETag memory allocation error handling. 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 | 1 + 1 file changed, 1 insertion(+) diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c index 4071b6126..3b36f4a19 100644 --- a/src/http/ngx_http_core_module.c +++ b/src/http/ngx_http_core_module.c @@ -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; }