mirror of
https://github.com/curl/curl.git
synced 2026-04-11 12:01:42 +08:00
curl_get_line: error out on read errors
Missing ferror handling in Curl_get_line causes infinite loops on I/O
errors, leading to denial-of-service hangs for config/cache file loads.
Follow-up to 769ccb4d42
Pointed out by Codex Security
Closes #20958
This commit is contained in:
parent
adda11330b
commit
ae09e5bf0d
@ -40,6 +40,8 @@ CURLcode Curl_get_line(struct dynbuf *buf, FILE *input, bool *eof)
|
|||||||
while(1) {
|
while(1) {
|
||||||
size_t rlen;
|
size_t rlen;
|
||||||
const char *b = fgets(buffer, sizeof(buffer), input);
|
const char *b = fgets(buffer, sizeof(buffer), input);
|
||||||
|
if(!b && ferror(input))
|
||||||
|
return CURLE_READ_ERROR;
|
||||||
|
|
||||||
*eof = feof(input);
|
*eof = feof(input);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user