idn: clarify null-termination on Windows
No binary (build failed)
—
(log yok)
| @@ -185,6 +185,9 @@ static CURLcode win32_idn_to_ascii(const char *in, char **out) | |
| wchar_t in_w[IDN_MAX_LENGTH]; | |
| int in_w_len; | |
| *out = NULL; | |
| + | /* Returned in_w_len includes the null-terminator, which then gets |
| + | preserved across the calls that follow, ending up terminating |
| + | the buffer returned to the caller. */ |
| in_w_len = MultiByteToWideChar(CP_UTF8, 0, in, -1, in_w, IDN_MAX_LENGTH); | |
| if(in_w_len) { | |
| wchar_t punycode[IDN_MAX_LENGTH]; | |
| @@ -208,6 +211,9 @@ static CURLcode win32_ascii_to_idn(const char *in, char **out) | |
| wchar_t in_w[IDN_MAX_LENGTH]; | |
| int in_w_len; | |
| *out = NULL; | |
| + | /* Returned in_w_len includes the null-terminator, which then gets |
| + | preserved across the calls that follow, ending up terminating |
| + | the buffer returned to the caller. */ |
| in_w_len = MultiByteToWideChar(CP_UTF8, 0, in, -1, in_w, IDN_MAX_LENGTH); | |
| if(in_w_len) { | |
| WCHAR idn[IDN_MAX_LENGTH]; /* stores a UTF-16 string */ | |