summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2021-08-31 16:44:13 +0300
committerMaxim Dounin <mdounin@mdounin.ru>2021-08-31 16:44:13 +0300
commit15bf6d8cc950d3aec2d1c3152b39f62be4939025 (patch)
tree3bbe770f6d3ba5b65d71b27a7efed6e569ace5d9
parent1e8c0d4e0673f50863230eda989867d3012fb349 (diff)
downloadnginx-15bf6d8cc950d3aec2d1c3152b39f62be4939025.tar.gz
HTTP/2: avoid memcpy() with NULL source and zero length.
Prodded by Clang Static Analyzer.
-rw-r--r--src/http/v2/ngx_http_v2.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/http/v2/ngx_http_v2.c b/src/http/v2/ngx_http_v2.c
index 5ccb36360..79c4f17c2 100644
--- a/src/http/v2/ngx_http_v2.c
+++ b/src/http/v2/ngx_http_v2.c
@@ -4241,7 +4241,9 @@ ngx_http_v2_process_request_body(ngx_http_request_t *r, u_char *pos,
n = size;
}
- rb->buf->last = ngx_cpymem(rb->buf->last, pos, n);
+ if (n > 0) {
+ rb->buf->last = ngx_cpymem(rb->buf->last, pos, n);
+ }
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, fc->log, 0,
"http2 request body recv %uz", n);