url.c: add a compile-time check that CURL_MAX_WRITE_SIZE is large enough

Some code (e.g. Curl_fillreadbuffer) assumes that this buffer is not
exceedingly tiny and will break if it is. This same check is already
done at run time in the CURLOPT_BUFFERSIZE option.
This commit is contained in:
Dan Fandrich 2017-05-13 22:54:59 +02:00
parent b1fa80b84f
commit d836c9fee4
2 changed files with 11 additions and 1 deletions

View file

@ -144,6 +144,15 @@ static unsigned int get_protocol_family(unsigned int protocol);
#define READBUFFER_MAX CURL_MAX_READ_SIZE
#define READBUFFER_MIN 1024
/* Some parts of the code (e.g. chunked encoding) assume this buffer has at
* more than just a few bytes to play with. Don't let it become too small or
* bad things will happen.
*/
#if READBUFFER_SIZE < READBUFFER_MIN
# error READBUFFER_SIZE is too small
#endif
/*
* Protocol table.
*/