From: Michael Kaufmann Date: Thu, 21 May 2020 11:10:04 +0000 (+0200) Subject: transfer: close connection after excess data has been read X-Git-Tag: curl-7_71_0~97 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3d44bfb08d4b230d2ad8b111469a8ae4c6957bca;p=thirdparty%2Fcurl.git transfer: close connection after excess data has been read For HTTP 1.x, it's a protocol error when the server sends more bytes than announced. If this happens, don't reuse the connection, because the start position of the next response is undefined. Closes #5440 --- diff --git a/lib/transfer.c b/lib/transfer.c index cc13bae181..dc43cf6ce1 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -838,6 +838,7 @@ static CURLcode readwrite_data(struct Curl_easy *data, ", maxdownload = %" CURL_FORMAT_CURL_OFF_T ", bytecount = %" CURL_FORMAT_CURL_OFF_T "\n", excess, k->size, k->maxdownload, k->bytecount); + connclose(conn, "excess found in a read"); } nread = (ssize_t) (k->maxdownload - k->bytecount);