summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPatrick Monnerat <patrick@monnerat.net>2017-10-08 19:05:59 +0100
committerPatrick Monnerat <patrick@monnerat.net>2017-10-08 19:05:59 +0100
commit70c3ed48ac737ab7fa83600313cf4bd9c2443ee5 (patch)
treee4456d93f3002bf6c5d08849b1041a6f215ffa1c /tests
parentebcbed3821533a884e18f9441084da9449514fdf (diff)
downloadcurl-70c3ed48ac737ab7fa83600313cf4bd9c2443ee5.tar.gz
test643: verify curl_mime_subparts() rejects cyclic additions.
Diffstat (limited to 'tests')
-rw-r--r--tests/libtest/lib643.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/libtest/lib643.c b/tests/libtest/lib643.c
index e26a2515f..7432dfce8 100644
--- a/tests/libtest/lib643.c
+++ b/tests/libtest/lib643.c
@@ -251,6 +251,30 @@ test_cleanup:
return res;
}
+static int cyclic_add(void)
+{
+ CURL *easy = curl_easy_init();
+ curl_mime *mime = curl_mime_init(easy);
+ curl_mimepart *part = curl_mime_addpart(mime);
+ CURLcode a1 = curl_mime_subparts(part, mime);
+
+ if(a1 == CURLE_BAD_FUNCTION_ARGUMENT) {
+ curl_mime *submime = curl_mime_init(easy);
+ curl_mimepart *subpart = curl_mime_addpart(submime);
+
+ curl_mime_subparts(part, submime);
+ a1 = curl_mime_subparts(subpart, mime);
+ }
+
+ curl_mime_free(mime);
+ curl_easy_cleanup(easy);
+ if(a1 != CURLE_BAD_FUNCTION_ARGUMENT)
+ /* that should have failed */
+ return 1;
+
+ return 0;
+}
+
int test(char *URL)
{
int res;
@@ -264,6 +288,9 @@ int test(char *URL)
if(!res)
res = once(URL, FALSE); /* new */
+ if(!res)
+ res = cyclic_add();
+
curl_global_cleanup();
return res;