]> git.ipfire.org Git - thirdparty/curl.git/commit
easy: resize receive buffer on easy handle reset
authorJay Satiro <raysatiro@yahoo.com>
Tue, 23 Jul 2019 21:59:18 +0000 (17:59 -0400)
committerJay Satiro <raysatiro@yahoo.com>
Fri, 26 Jul 2019 02:24:06 +0000 (22:24 -0400)
commit78ed3abe11de0d8fe465dee6d1de0c1b973f4409
treea03e9b93f0b8131930579dbb6ee862ff6b29c678
parentfd5ab4358f09fafc83fc82ffd88c2c0b1c534c15
easy: resize receive buffer on easy handle reset

- In curl_easy_reset attempt to resize the receive buffer to its default
  size. If realloc fails then continue using the previous size.

Prior to this change curl_easy_reset did not properly handle resetting
the receive buffer (data->state.buffer). It reset the variable holding
its size (data->set.buffer_size) to the default size (READBUFFER_SIZE)
but then did not actually resize the buffer. If a user resized the
buffer by using CURLOPT_BUFFERSIZE to set the size smaller than the
default, later called curl_easy_reset and attempted to reuse the handle
then a heap overflow would very likely occur during that handle's next
transfer.

Reported-by: Felix Hädicke
Fixes https://github.com/curl/curl/issues/4143
Closes https://github.com/curl/curl/pull/4145
lib/easy.c