From 5067e220cafcd865f49c57085065d18d710d7ae1 Mon Sep 17 00:00:00 2001 From: chundonglinlin Date: Mon, 20 Mar 2023 12:51:02 +0800 Subject: [PATCH] HttpConn: judge nb_chunk no memory address. (#3465) Co-authored-by: john --- trunk/src/protocol/srs_protocol_http_conn.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/trunk/src/protocol/srs_protocol_http_conn.cpp b/trunk/src/protocol/srs_protocol_http_conn.cpp index dee58c370..a885065b4 100644 --- a/trunk/src/protocol/srs_protocol_http_conn.cpp +++ b/trunk/src/protocol/srs_protocol_http_conn.cpp @@ -1162,7 +1162,9 @@ srs_error_t SrsHttpResponseReader::read_chunked(void* data, size_t nb_data, ssiz if (nb_chunk <= 0) { // for the last chunk, eof. is_eof = true; - *nb_read = 0; + if (nb_read) { + *nb_read = 0; + } } else { // for not the last chunk, there must always exists bytes. // left bytes in chunk, read some.