# HG changeset patch # User Maxim Dounin # Date 1630417453 -10800 # Node ID 29795b697e140b3b016cfbc5f0e37be779295b45 # Parent 09d15a2dbc6bf534c7b20b63c05ffaa46526606b HTTP/2: avoid memcpy() with NULL source and zero length. Prodded by Clang Static Analyzer. diff --git a/src/http/v2/ngx_http_v2.c b/src/http/v2/ngx_http_v2.c --- 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_htt 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);