diff src/http/v3/ngx_http_v3_request.c @ 7685:1307308c3cf1 quic

Temporary fix for header null-termination in HTTP/3.
author Roman Arutyunyan <arut@nginx.com>
date Sat, 14 Mar 2020 13:18:55 +0300
parents 38c0898b6df7
children 268f4389130d
line wrap: on
line diff
--- a/src/http/v3/ngx_http_v3_request.c
+++ b/src/http/v3/ngx_http_v3_request.c
@@ -518,6 +518,18 @@ done:
         }
     }
 
+    /* XXX ugly reallocation for the trailing '\0' */
+
+    p = ngx_pnalloc(c->pool, name.len + value.len + 2);
+    if (p == NULL) {
+        return NGX_ERROR;
+    }
+
+    ngx_memcpy(p, name.data, name.len);
+    name.data = p;
+    ngx_memcpy(p + name.len + 1, value.data, value.len);
+    value.data = p + name.len + 1;
+
     ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0,
                    "http3 header \"%V\":\"%V\"", &name, &value);