sendf: getting less data than "max allowed" is okay

Easily triggered when doing an FTP ranged download with the end range
larger than the file size.

A regression since 30de937bda (shipped in curl 8.9.0)

Add test 2307 to verify.

Reported-by: kupavcevdenis on github
Fixes #18283
Closes #18295
This commit is contained in:
Daniel Stenberg 2025-08-15 09:23:33 +02:00
parent b2294996b6
commit c5f76b8096
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
3 changed files with 64 additions and 4 deletions

View file

@ -293,9 +293,9 @@ static CURLcode cw_download_write(struct Curl_easy *data,
}
if((type & CLIENTWRITE_EOS) && !data->req.no_body &&
(data->req.maxdownload > data->req.bytecount)) {
(data->req.size > data->req.bytecount)) {
failf(data, "end of response with %" FMT_OFF_T " bytes missing",
data->req.maxdownload - data->req.bytecount);
data->req.size - data->req.bytecount);
return CURLE_PARTIAL_FILE;
}
}