comparison src/http/modules/ngx_http_fastcgi_module.c @ 7001:08537eab4f23

Upstream: fixed u->headers_in.headers allocation error handling. Previously, an allocation error resulted in uninitialized memory access when evaluating $upstream_http_ variables. On a related note, see r->headers_out.headers cleanup work in 0cdee26605f3.
author Sergey Kandaurov <pluknet@nginx.com>
date Thu, 18 May 2017 14:17:00 +0300
parents fa56ab75cffc
children 2a288909abc6
comparison
equal deleted inserted replaced
7000:d8e8ced78e77 7001:08537eab4f23
1876 size += part[i].end - part[i].start; 1876 size += part[i].end - part[i].start;
1877 } 1877 }
1878 1878
1879 p = ngx_pnalloc(r->pool, size); 1879 p = ngx_pnalloc(r->pool, size);
1880 if (p == NULL) { 1880 if (p == NULL) {
1881 h->hash = 0;
1881 return NGX_ERROR; 1882 return NGX_ERROR;
1882 } 1883 }
1883 1884
1884 buf.pos = p; 1885 buf.pos = p;
1885 1886
1898 1899
1899 if (rc != NGX_OK) { 1900 if (rc != NGX_OK) {
1900 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, 1901 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
1901 "invalid header after joining " 1902 "invalid header after joining "
1902 "FastCGI records"); 1903 "FastCGI records");
1904 h->hash = 0;
1903 return NGX_ERROR; 1905 return NGX_ERROR;
1904 } 1906 }
1905 1907
1906 h->key.len = r->header_name_end - r->header_name_start; 1908 h->key.len = r->header_name_end - r->header_name_start;
1907 h->key.data = r->header_name_start; 1909 h->key.data = r->header_name_start;
1923 1925
1924 h->key.data = ngx_pnalloc(r->pool, 1926 h->key.data = ngx_pnalloc(r->pool,
1925 h->key.len + 1 + h->value.len + 1 1927 h->key.len + 1 + h->value.len + 1
1926 + h->key.len); 1928 + h->key.len);
1927 if (h->key.data == NULL) { 1929 if (h->key.data == NULL) {
1930 h->hash = 0;
1928 return NGX_ERROR; 1931 return NGX_ERROR;
1929 } 1932 }
1930 1933
1931 h->value.data = h->key.data + h->key.len + 1; 1934 h->value.data = h->key.data + h->key.len + 1;
1932 h->lowcase_key = h->key.data + h->key.len + 1 1935 h->lowcase_key = h->key.data + h->key.len + 1