From: Daniel Stenberg Date: Wed, 24 Jun 2020 13:24:35 +0000 (+0200) Subject: test543: extended to verify zero length input X-Git-Tag: curl-7_71_1~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=79d8099ff0f826e213846af78436048d06cd48db;p=thirdparty%2Fcurl.git test543: extended to verify zero length input As was reported in #5601 --- diff --git a/tests/data/test543 b/tests/data/test543 index 4556330375..f7e687c46e 100644 --- a/tests/data/test543 +++ b/tests/data/test543 @@ -30,6 +30,8 @@ curl_easy_escape %9C%26K%3DI%04%A1%01%E0%D8%7C%20%B7%EFS%29%FA%1DW%E1 +IN: '' OUT: '' +IN: ' 12' OUT: '%2012' diff --git a/tests/libtest/lib543.c b/tests/libtest/lib543.c index 5fe5cd1ce7..c494d3d83f 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();