]> granicus.if.org Git - curl/commitdiff
Using CURLOPT_POST without using CURLOPT_POSTFIELDS caused us to strlen()
authorDaniel Stenberg <daniel@haxx.se>
Wed, 15 Aug 2001 13:38:36 +0000 (13:38 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 15 Aug 2001 13:38:36 +0000 (13:38 +0000)
a NULL pointer. Now, we treat a missing CURLOPT_POSTFIELDS as if there is
no data to send.

lib/http.c

index 16c03b123b242e45916513313965608120a9b40c..ba9685642104665c226f3b9d8fbe41cec6bd467c 100644 (file)
@@ -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 */