summaryrefslogtreecommitdiffstats
path: root/Utilities/cmcurl/lib/formdata.c
diff options
context:
space:
mode:
Diffstat (limited to 'Utilities/cmcurl/lib/formdata.c')
-rw-r--r--Utilities/cmcurl/lib/formdata.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/Utilities/cmcurl/lib/formdata.c b/Utilities/cmcurl/lib/formdata.c
index ac7a000..5fefd7a 100644
--- a/Utilities/cmcurl/lib/formdata.c
+++ b/Utilities/cmcurl/lib/formdata.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -33,7 +33,6 @@
#include "urldata.h" /* for struct Curl_easy */
#include "mime.h"
-#include "non-ascii.h"
#include "vtls/vtls.h"
#include "strcase.h"
#include "sendf.h"
@@ -77,10 +76,15 @@ AddHttpPost(char *name, size_t namelength,
struct curl_httppost **last_post)
{
struct curl_httppost *post;
+ if(!namelength && name)
+ namelength = strlen(name);
+ if((bufferlength > LONG_MAX) || (namelength > LONG_MAX))
+ /* avoid overflow in typecasts below */
+ return NULL;
post = calloc(1, sizeof(struct curl_httppost));
if(post) {
post->name = name;
- post->namelength = (long)(name?(namelength?namelength:strlen(name)):0);
+ post->namelength = (long)namelength;
post->contents = value;
post->contentlen = contentslength;
post->buffer = buffer;
@@ -269,14 +273,8 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
* Set the Name property.
*/
case CURLFORM_PTRNAME:
-#ifdef CURL_DOES_CONVERSIONS
- /* Treat CURLFORM_PTR like CURLFORM_COPYNAME so that libcurl will copy
- * the data in all cases so that we'll have safe memory for the eventual
- * conversion.
- */
-#else
current_form->flags |= HTTPPOST_PTRNAME; /* fall through */
-#endif
+
/* FALLTHROUGH */
case CURLFORM_COPYNAME:
if(current_form->name)
@@ -901,11 +899,6 @@ CURLcode Curl_getformdata(struct Curl_easy *data,
else
uclen = (size_t)clen;
result = curl_mime_data(part, post->contents, uclen);
-#ifdef CURL_DOES_CONVERSIONS
- /* Convert textual contents now. */
- if(!result && data && part->datasize)
- result = Curl_convert_to_network(data, part->data, part->datasize);
-#endif
}
}