From a6d134e17ab8efb2f8fa7c4ff877f6ddb9685f14 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 11 Feb 2019 09:17:07 +0100 Subject: [PATCH] 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 --- lib/transfer.c | 5 ++++- lib/urldata.h | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) 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;