From: Daniel Stenberg Date: Mon, 11 Feb 2019 08:17:07 +0000 (+0100) Subject: pretransfer: don't strlen() POSTFIELDS set for GET requests X-Git-Tag: curl-7_64_1~157 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a6d134e17ab8efb2f8fa7c4ff877f6ddb9685f14;p=curl pretransfer: don't strlen() POSTFIELDS set for GET requests ... since that data won't be used in the request anyway. Fixes #3548 Reported-by: Renaud Allard Close #3549 --- diff --git a/lib/transfer.c b/lib/transfer.c index 3a18c7bdd..27fe79074 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -1526,11 +1526,14 @@ CURLcode Curl_pretransfer(struct Curl_easy *data) if(data->set.httpreq == HTTPREQ_PUT) data->state.infilesize = data->set.filesize; - else { + else if((data->set.httpreq != HTTPREQ_GET) && + (data->set.httpreq != HTTPREQ_HEAD)) { data->state.infilesize = data->set.postfieldsize; if(data->set.postfields && (data->state.infilesize == -1)) data->state.infilesize = (curl_off_t)strlen(data->set.postfields); } + else + data->state.infilesize = 0; /* If there is a list of cookie files to read, do it now! */ if(data->change.cookielist) diff --git a/lib/urldata.h b/lib/urldata.h index ff3cc9a65..e137569ac 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -1150,7 +1150,6 @@ typedef enum { HTTPREQ_PUT, HTTPREQ_HEAD, HTTPREQ_OPTIONS, - HTTPREQ_CUSTOM, HTTPREQ_LAST /* last in list */ } Curl_HttpReq;