mirror of
https://github.com/curl/curl.git
synced 2026-04-14 22:41:40 +03:00
http1: fix potential NULL dereference in Curl_h1_req_parse_read()
Reported by clang-tidy v22 with `clang-analyzer-*` explicitly enabled:
```
lib/http1.c:89:31: error: Subtraction of a non-null pointer
(from variable 'line_end') and a null pointer (via field 'line')
results in undefined behavior [clang-analyzer-core.NullPointerArithm]
89 | parser->line_len = line_end - parser->line + 1;
| ^
```
Ref: https://github.com/curl/curl/actions/runs/22534731241/job/65279952830?pr=20778#step:11:85
Ref: #20778
Closes #20779
This commit is contained in:
parent
7fe5b933d8
commit
da6fbb12a6
1 changed files with 5 additions and 0 deletions
|
|
@ -269,6 +269,11 @@ CURLcode Curl_h1_req_parse_read(struct h1_req_parser *parser,
|
||||||
size_t nread;
|
size_t nread;
|
||||||
|
|
||||||
*pnread = 0;
|
*pnread = 0;
|
||||||
|
|
||||||
|
DEBUGASSERT(buf);
|
||||||
|
if(!buf)
|
||||||
|
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||||
|
|
||||||
while(!parser->done) {
|
while(!parser->done) {
|
||||||
result = next_line(parser, buf, buflen, options, &nread);
|
result = next_line(parser, buf, buflen, options, &nread);
|
||||||
if(result) {
|
if(result) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue