From: Daniel Stenberg Date: Wed, 3 Sep 2025 10:47:07 +0000 (+0200) Subject: test763: verify IDN hostname with zero width characters only X-Git-Tag: curl-8_16_0~36 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=de86c2483f715faeb73527fd8a1a096f52927778;p=thirdparty%2Fcurl.git test763: verify IDN hostname with zero width characters only Bonus: fix memory leak in exit path from 967a626af48aafd37 Closes #18465 --- diff --git a/lib/idn.c b/lib/idn.c index 28c45d6681..bb6fd2cffc 100644 --- a/lib/idn.c +++ b/lib/idn.c @@ -324,8 +324,10 @@ CURLcode Curl_idn_decode(const char *input, char **output) } #endif if(!result) { - if(!d[0]) /* ended up zero length, not acceptable */ + if(!d[0]) { /* ended up zero length, not acceptable */ result = CURLE_URL_MALFORMAT; + free(d); + } else *output = d; } diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am index 9d1fcbb759..daed381e47 100644 --- a/tests/data/Makefile.am +++ b/tests/data/Makefile.am @@ -109,6 +109,7 @@ test727 test728 test729 test730 test731 test732 test733 test734 test735 \ test736 test737 test738 test739 test740 test741 test742 test743 test744 \ test745 test746 test747 test748 test749 test750 test751 test752 test753 \ test754 test755 test756 test757 test758 test759 test760 test761 test762 \ +test763 \ \ test780 test781 test782 test783 test784 test785 test786 test787 test788 \ test789 test790 test791 test792 test793 test794 test795 test796 test797 \ diff --git a/tests/data/test763 b/tests/data/test763 new file mode 100644 index 0000000000..75059ef320 --- /dev/null +++ b/tests/data/test763 @@ -0,0 +1,29 @@ + + + +IDN + + + + + +IDN +!AppleIDN + + +Unicode hostname ending up in a blank name + +# e2 80 8b - ZERO WIDTH SPACE +# e2 80 8c - ZERO WIDTH NON-JOINER + +%hex['%e2%80%8b%e2%80%8c']hex% + + + + +# curl: (3) URL using bad/illegal format or missing URL + +3 + + +