mirror of
https://github.com/curl/curl.git
synced 2025-09-13 23:52:42 +03:00
parent
2959f45b7d
commit
ac4dbc9cb5
23
lib/setopt.c
23
lib/setopt.c
|
@ -51,7 +51,7 @@
|
||||||
#include "altsvc.h"
|
#include "altsvc.h"
|
||||||
#include "hsts.h"
|
#include "hsts.h"
|
||||||
#include "tftp.h"
|
#include "tftp.h"
|
||||||
|
#include "strdup.h"
|
||||||
/* The last 3 #include files should be in this order */
|
/* The last 3 #include files should be in this order */
|
||||||
#include "curl_printf.h"
|
#include "curl_printf.h"
|
||||||
#include "curl_memory.h"
|
#include "curl_memory.h"
|
||||||
|
@ -508,26 +508,17 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
|
||||||
(data->set.postfieldsize > (curl_off_t)((size_t)-1))))
|
(data->set.postfieldsize > (curl_off_t)((size_t)-1))))
|
||||||
result = CURLE_OUT_OF_MEMORY;
|
result = CURLE_OUT_OF_MEMORY;
|
||||||
else {
|
else {
|
||||||
char *p;
|
|
||||||
|
|
||||||
(void) Curl_setstropt(&data->set.str[STRING_COPYPOSTFIELDS], NULL);
|
|
||||||
|
|
||||||
/* Allocate even when size == 0. This satisfies the need of possible
|
/* Allocate even when size == 0. This satisfies the need of possible
|
||||||
later address compare to detect the COPYPOSTFIELDS mode, and
|
later address compare to detect the COPYPOSTFIELDS mode, and to
|
||||||
to mark that postfields is used rather than read function or
|
mark that postfields is used rather than read function or form
|
||||||
form data.
|
data.
|
||||||
*/
|
*/
|
||||||
p = malloc((size_t)(data->set.postfieldsize?
|
char *p = Curl_memdup0(argptr, (size_t)data->set.postfieldsize);
|
||||||
data->set.postfieldsize:1));
|
(void) Curl_setstropt(&data->set.str[STRING_COPYPOSTFIELDS], NULL);
|
||||||
|
|
||||||
if(!p)
|
if(!p)
|
||||||
result = CURLE_OUT_OF_MEMORY;
|
result = CURLE_OUT_OF_MEMORY;
|
||||||
else {
|
else
|
||||||
if(data->set.postfieldsize)
|
|
||||||
memcpy(p, argptr, (size_t)data->set.postfieldsize);
|
|
||||||
|
|
||||||
data->set.str[STRING_COPYPOSTFIELDS] = p;
|
data->set.str[STRING_COPYPOSTFIELDS] = p;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user