Welcome! Log In Create A New Profile

Advanced

[nginx] HTTP/2: avoid memcpy() with NULL source and zero length.

Maxim Dounin
August 31, 2021 09:54AM
details: https://hg.nginx.org/nginx/rev/29795b697e14
branches:
changeset: 7916:29795b697e14
user: Maxim Dounin <mdounin@mdounin.ru>
date: Tue Aug 31 16:44:13 2021 +0300
description:
HTTP/2: avoid memcpy() with NULL source and zero length.

Prodded by Clang Static Analyzer.

diffstat:

src/http/v2/ngx_http_v2.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)

diffs (14 lines):

diff -r 09d15a2dbc6b -r 29795b697e14 src/http/v2/ngx_http_v2.c
--- a/src/http/v2/ngx_http_v2.c Mon Aug 30 14:45:21 2021 +0300
+++ b/src/http/v2/ngx_http_v2.c Tue Aug 31 16:44:13 2021 +0300
@@ -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);
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] HTTP/2: avoid memcpy() with NULL source and zero length.

Maxim Dounin 345 August 31, 2021 09:54AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 182
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready