aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2001-08-15 13:38:36 +0000
committerDaniel Stenberg <daniel@haxx.se>2001-08-15 13:38:36 +0000
commit70ad8a0b2be173a71a0e55263da55c78fcd505b6 (patch)
treefd7180035c923d343ad37643d9f8a8df91a9424a
parentcec8a3afb2c0103571220b64a20fa62a886abb8c (diff)
Using CURLOPT_POST without using CURLOPT_POSTFIELDS caused us to strlen()
a NULL pointer. Now, we treat a missing CURLOPT_POSTFIELDS as if there is no data to send.
-rw-r--r--lib/http.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/http.c b/lib/http.c
index 16c03b123..ba9685642 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -764,6 +764,17 @@ CURLcode Curl_http(struct connectdata *conn)
if(HTTPREQ_POST == data->httpreq) {
/* this is the simple POST, using x-www-form-urlencoded style */
+ if(!data->postfields) {
+ /*
+ * This is an attempt to do a POST without having anything to
+ * actually send. Let's make a NULL pointer equal "" here. Good/bad
+ * ?
+ */
+ data->postfields = "";
+ data->postfieldsize = 0; /* it might been set to something illegal,
+ anything > 0 would be! */
+ }
+
if(!checkheaders(data, "Content-Length:"))
/* we allow replacing this header, although it isn't very wise to
actually set your own */