gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnurl] 16/29: curl: properly free mimepost data


From: gnunet
Subject: [gnurl] 16/29: curl: properly free mimepost data
Date: Fri, 10 Jan 2020 23:05:54 +0100

This is an automated email from the git hooks/post-receive script.

ng0 pushed a commit to branch master
in repository gnurl.

commit 392bff4abf6b177d0770bcb26e43ae5d7addd7c9
Author: Daniel Stenberg <address@hidden>
AuthorDate: Sat Jan 4 21:40:49 2020 +0100

    curl: properly free mimepost data
    
    ... as it could otherwise leak memory when a transfer failed.
    
    Added test 1293 to verify.
    
    Reported-by: Brian Carpenter
    Fixes #4781
    Closes #4782
---
 src/tool_operate.c      |  3 +++
 tests/data/Makefile.inc |  4 +--
 tests/data/test1293     | 67 +++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 72 insertions(+), 2 deletions(-)

diff --git a/src/tool_operate.c b/src/tool_operate.c
index 9dc59b2e9..2bee9349a 100644
--- a/src/tool_operate.c
+++ b/src/tool_operate.c
@@ -1357,6 +1357,9 @@ static CURLcode single_transfer(struct GlobalConfig 
*global,
                     config->postfieldsize);
           break;
         case HTTPREQ_MIMEPOST:
+          /* free previous remainders */
+          curl_mime_free(config->mimepost);
+          config->mimepost = NULL;
           result = tool2curlmime(curl, config->mimeroot, &config->mimepost);
           if(result)
             break;
diff --git a/tests/data/Makefile.inc b/tests/data/Makefile.inc
index 5e93b089d..edfa61b0e 100644
--- a/tests/data/Makefile.inc
+++ b/tests/data/Makefile.inc
@@ -5,7 +5,7 @@
 #                            | (__| |_| |  _ <| |___
 #                             \___|\___/|_| \_\_____|
 #
-# Copyright (C) 1998 - 2019, Daniel Stenberg, <address@hidden>, et al.
+# Copyright (C) 1998 - 2020, Daniel Stenberg, <address@hidden>, et al.
 #
 # This software is licensed as described in the file COPYING, which
 # you should have received as part of this distribution. The terms
@@ -146,7 +146,7 @@ test1260 test1261 test1262 test1263 test1264 test1265 
test1266 test1267 \
 test1268 test1269 test1270 \
 \
 test1280 test1281 test1282 test1283 test1284 test1285 test1286 test1287 \
-test1288 test1289 test1290 test1291 test1292 \
+test1288 test1289 test1290 test1291 test1292 test1293 \
 test1298 test1299 \
 test1300 test1301 test1302 test1303 test1304 test1305 test1306 test1307 \
 test1308 test1309 test1310 test1311 test1312 test1313 test1314 test1315 \
diff --git a/tests/data/test1293 b/tests/data/test1293
new file mode 100644
index 000000000..11a28a326
--- /dev/null
+++ b/tests/data/test1293
@@ -0,0 +1,67 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+-F
+</keywords>
+</info>
+
+#
+# Server-side
+<reply>
+<data nocheck="yes">
+HTTP/1.1 200 OK
+Date: Thu, 09 Nov 2010 14:49:00 GMT
+Server: test-server/fake
+Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT
+ETag: "21025-dc7-39462498"
+Accept-Ranges: bytes
+Content-Length: 6
+Connection: close
+Content-Type: text/html
+Funny-head: yesyes
+
+-foo-
+</data>
+</reply>
+
+#
+# Client-side
+<client>
+<server>
+http
+</server>
+ <name>
+Multipart formpost to two URLs, the first failing
+ </name>
+ <command>
+http://0 http://%HOSTIP:%HTTPPORT/1293 -F=
+</command>
+</client>
+
+#
+# Verify data after the test has been "shot"
+<verify>
+<strip>
+^User-Agent:.*
+</strip>
+<strippart>
+s/^--------------------------[a-z0-9]*/------------------------------/
+s/boundary=------------------------[a-z0-9]*/boundary=----------------------------/
+</strippart>
+<protocol>
+POST /1293 HTTP/1.1
+Host: 127.0.0.1:8990
+Accept: */*
+Content-Length: 126
+Content-Type: multipart/form-data; boundary=----------------------------
+
+------------------------------
+Content-Disposition: form-data
+
+
+--------------------------------
+</protocol>
+</verify>
+</testcase>

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]