tool_formparse: propagate my_get_line errors when reading headers

The read_field_headers() function would return "ok" even if the
underlying file read returned error, thus would the parent not become
aware of the problem.

Follow-up to f847d2ed02

Found by Codex Security

Closes #20963
This commit is contained in:
Daniel Stenberg 2026-03-17 16:22:54 +01:00
parent 0d7677ac72
commit 80b6cd92af
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -464,6 +464,10 @@ static int read_field_headers(FILE *fp, struct curl_slist **pheaders)
break;
}
}
if(error && !err) {
errorf("Failed to read field headers");
err = -1;
}
curlx_dyn_free(&line);
return err;
}