kernel/util: Accept inputs of 0 bytes in utf16_to_utf8.
There's no reason to reject them; they should just result in a zero-byte output. Should fix #20222. (cherry picked from commit 4b6aad38968f9fe91712e742aff9166fec6e67a1) Change-Id: Ifdbe17618d74eca0b873a6808ec0b14a7d38189a Reviewed-on: https://review.haiku-os.org/c/haiku/+/11402 Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
f90957116e
commit
b641780cc9
@@ -59,10 +59,8 @@ static ssize_t
|
|||||||
utf16_to_utf8(const uint16* source, size_t sourceCodeUnitCount, char* target,
|
utf16_to_utf8(const uint16* source, size_t sourceCodeUnitCount, char* target,
|
||||||
size_t targetLength, bool isLittleEndian)
|
size_t targetLength, bool isLittleEndian)
|
||||||
{
|
{
|
||||||
if (source == NULL || sourceCodeUnitCount == 0
|
if (source == NULL || target == NULL || targetLength == 0)
|
||||||
|| target == NULL || targetLength == 0) {
|
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
}
|
|
||||||
|
|
||||||
ssize_t outLength = 0;
|
ssize_t outLength = 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user