diff options
author | George Hazan <ghazan@miranda.im> | 2022-06-10 11:22:26 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2022-06-10 11:22:26 +0300 |
commit | 05ad15444053fbede236dc40320d17e44eb88fd3 (patch) | |
tree | 330ca69a55078fee19f1fa1f80dc3dbb71e0667e /libs/libcurl/src/formdata.c | |
parent | 47d5ff93323f788ed160c930617a2c997c803453 (diff) | |
parent | 08abeb3aa33a4bbbddc75f2d56799e8ab056fc73 (diff) |
Merge branch 'master' of https://github.com/miranda-ng/miranda-ng
Diffstat (limited to 'libs/libcurl/src/formdata.c')
-rw-r--r-- | libs/libcurl/src/formdata.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/libs/libcurl/src/formdata.c b/libs/libcurl/src/formdata.c index ac7a0009cd..5fefd7a6ef 100644 --- a/libs/libcurl/src/formdata.c +++ b/libs/libcurl/src/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 } } |