summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2020-06-24 15:24:35 +0200
committerDaniel Stenberg <daniel@haxx.se>2020-06-24 15:24:35 +0200
commitad6d7080ce202434d7dda267b33aabf95091a2cb (patch)
tree7a3c6cacd11d385bf814be6f9b7fc14c71fc02ad
parent95e4d470563516eb11e2e0d92b18d88a14fc587c (diff)
downloadcurl-bagder/escape-zero-string.tar.gz
test543: extended to verify zero length inputbagder/escape-zero-string
As was reported in #5601
-rw-r--r--tests/data/test5432
-rw-r--r--tests/libtest/lib543.c14
2 files changed, 14 insertions, 2 deletions
diff --git a/tests/data/test543 b/tests/data/test543
index 455633037..f7e687c46 100644
--- a/tests/data/test543
+++ b/tests/data/test543
@@ -30,6 +30,8 @@ curl_easy_escape
<verify>
<stdout>
%9C%26K%3DI%04%A1%01%E0%D8%7C%20%B7%EFS%29%FA%1DW%E1
+IN: '' OUT: ''
+IN: ' 12' OUT: '%2012'
</stdout>
</verify>
</testcase>
diff --git a/tests/libtest/lib543.c b/tests/libtest/lib543.c
index 5fe5cd1ce..c494d3d83 100644
--- a/tests/libtest/lib543.c
+++ b/tests/libtest/lib543.c
@@ -49,11 +49,21 @@ int test(char *URL)
s = curl_easy_escape(easy, (const char *)a, asize);
- if(s)
+ if(s) {
printf("%s\n", s);
+ curl_free(s);
+ }
- if(s)
+ s = curl_easy_escape(easy, "", 0);
+ if(s) {
+ printf("IN: '' OUT: '%s'\n", s);
curl_free(s);
+ }
+ s = curl_easy_escape(easy, " 123", 3);
+ if(s) {
+ printf("IN: ' 12' OUT: '%s'\n", s);
+ curl_free(s);
+ }
curl_easy_cleanup(easy);
curl_global_cleanup();