@cryptotaxi247 / netdata-1 / commits / 1c8e72dfe

Fix CID 398318 (#15766)

Timotej S committed Aug 8, 2023 at 16:59 UTC 1c8e72dfea192a4ef33e9c29aa3861a495a58625
1 file changed +4 -3
aclk/https_client.c
+4 -3
@@ -183,18 +183,19 @@ static int process_chunked_content(rbuf_t buf, http_parse_ctx *parse_ctx)
183 char buf_size[HTTP_HDR_BUFFER_SIZE];
184 rbuf_pop(buf, buf_size, idx);
185 buf_size[idx] = 0;
186 - parse_ctx->chunk_size = strtol(buf_size, NULL, 16);
187 - if (parse_ctx->chunk_size < 0 || parse_ctx->chunk_size == LONG_MAX) {
186 + long chunk_size = strtol(buf_size, NULL, 16);
187 + if (chunk_size < 0 || chunk_size == LONG_MAX) {
188 netdata_log_error("Chunk size out of range");
189 return PARSE_ERROR;
190 }
191 + parse_ctx->chunk_size = chunk_size;
192 if (parse_ctx->chunk_size == 0) {
193 if (errno == EINVAL) {
194 netdata_log_error("Invalid chunk size");
195 return PARSE_ERROR;
196 }
197 parse_ctx->chunked_content_state = CHUNKED_CONTENT_CHUNK_END_CRLF;
197 - return 0;
198 + continue;
199 }
200 parse_ctx->chunk_got = 0;
201 chunked_response_buffer_grow_by(parse_ctx, parse_ctx->chunk_size);