[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnurl] 12/411: setopt: if the buffer exists, refuse the new BUFFERSIZE
From: |
gnunet |
Subject: |
[gnurl] 12/411: setopt: if the buffer exists, refuse the new BUFFERSIZE |
Date: |
Wed, 13 Jan 2021 01:17:07 +0100 |
This is an automated email from the git hooks/post-receive script.
nikita pushed a commit to branch master
in repository gnurl.
commit bc3b5bcf87f9fe16514f8cfd84cded24a367ac95
Author: Daniel Stenberg <daniel@haxx.se>
AuthorDate: Fri Aug 21 16:19:27 2020 +0200
setopt: if the buffer exists, refuse the new BUFFERSIZE
The buffer only exists during transfer and then we shouldn't change the
size (the setopt is not documented to work then).
Reported-by: Harry Sintonen
Closes #5842
---
lib/setopt.c | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/lib/setopt.c b/lib/setopt.c
index d6213357c..768452ca1 100644
--- a/lib/setopt.c
+++ b/lib/setopt.c
@@ -2075,6 +2075,9 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption
option, va_list param)
* The application kindly asks for a differently sized receive buffer.
* If it seems reasonable, we'll use it.
*/
+ if(data->state.buffer)
+ return CURLE_BAD_FUNCTION_ARGUMENT;
+
arg = va_arg(param, long);
if(arg > READBUFFER_MAX)
@@ -2084,18 +2087,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption
option, va_list param)
else if(arg < READBUFFER_MIN)
arg = READBUFFER_MIN;
- /* Resize if new size */
- if((arg != data->set.buffer_size) && data->state.buffer) {
- char *newbuff = realloc(data->state.buffer, arg + 1);
- if(!newbuff) {
- DEBUGF(fprintf(stderr, "Error: realloc of buffer failed\n"));
- result = CURLE_OUT_OF_MEMORY;
- }
- else
- data->state.buffer = newbuff;
- }
data->set.buffer_size = arg;
-
break;
case CURLOPT_UPLOAD_BUFFERSIZE:
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [gnurl] 23/411: select: reduce duplication of Curl_poll in Curl_socket_check, (continued)
- [gnurl] 23/411: select: reduce duplication of Curl_poll in Curl_socket_check, gnunet, 2021/01/12
- [gnurl] 28/411: winbuild/README.md: make <options> visible, gnunet, 2021/01/12
- [gnurl] 31/411: git: ignore libtests in 3XXX area, gnunet, 2021/01/12
- [gnurl] 26/411: lib1560: verify "redirect" to double-slash leading URL, gnunet, 2021/01/12
- [gnurl] 17/411: sftp: add the option CURLKHSTAT_FINE_REPLACE, gnunet, 2021/01/12
- [gnurl] 19/411: curl: add --output-dir, gnunet, 2021/01/12
- [gnurl] 30/411: doh: add error message for DOH_DNS_NAME_TOO_LONG, gnunet, 2021/01/12
- [gnurl] 29/411: ngtcp2: adapt to the new pkt_info arguments, gnunet, 2021/01/12
- [gnurl] 16/411: RELEASE-NOTES: synced, gnunet, 2021/01/12
- [gnurl] 24/411: multi: implement wait using winsock events, gnunet, 2021/01/12
- [gnurl] 12/411: setopt: if the buffer exists, refuse the new BUFFERSIZE,
gnunet <=
- [gnurl] 13/411: etag: save and use the full received contents, gnunet, 2021/01/12
- [gnurl] 27/411: winbuild: convert the instruction text to README.md, gnunet, 2021/01/12
- [gnurl] 15/411: checksrc: verify do-while and spaces between the braces, gnunet, 2021/01/12
- [gnurl] 59/411: docs: add description about CI platforms to CONTRIBUTE.md, gnunet, 2021/01/12
- [gnurl] 67/411: curl.1: add see also no-progress-meter on two spots, gnunet, 2021/01/12
- [gnurl] 41/411: docs/libcurl: update "Added in" version for curl_easy_option*, gnunet, 2021/01/12
- [gnurl] 35/411: openssl: Fix wincrypt symbols conflict with BoringSSL, gnunet, 2021/01/12
- [gnurl] 18/411: configure: fix pkg-config detecting wolfssl, gnunet, 2021/01/12
- [gnurl] 32/411: schannel: fix memory leak when using get_cert_location, gnunet, 2021/01/12
- [gnurl] 10/411: CURLE_PROXY: new error code, gnunet, 2021/01/12