[core,settings] fix freerdp_settings_set_string_from_utf16N

If the input string has a length, but the string length is 0 do not
return failure.
This commit is contained in:
Armin Novak
2023-01-18 10:31:00 +01:00
committed by akallabeth
parent 075506f6c8
commit f4ee5226b0

View File

@@ -2048,7 +2048,13 @@ BOOL freerdp_settings_set_string_from_utf16N(rdpSettings* settings, size_t id, c
char* str = ConvertWCharNToUtf8Alloc(param, length, &len);
if (!str && (length != 0))
return FALSE;
{
/* If the input string is an empty string, but length > 0
* consider the conversion a success */
const size_t wlen = _wcsnlen(param, length);
if (wlen != 0)
return FALSE;
}
return freerdp_settings_set_string_(settings, id, str, len, FALSE, TRUE);
}