diff options
Diffstat (limited to 'src/argv')
-rw-r--r-- | src/argv/ntapi_tt_array_utf16.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/argv/ntapi_tt_array_utf16.c b/src/argv/ntapi_tt_array_utf16.c index 540a7c1..6235606 100644 --- a/src/argv/ntapi_tt_array_utf16.c +++ b/src/argv/ntapi_tt_array_utf16.c @@ -169,16 +169,15 @@ int32_t __stdcall __ntapi_tt_array_convert_utf16_to_utf8( wchar16_t u_high; ptrdiff_t diff; - #define __UTF8_MAX_CODE_POINT_BYTES (4) - ch = (uint8_t *)buffer; - ubound = (uint8_t *)buffer + buffer_len - __UTF8_MAX_CODE_POINT_BYTES; + ubound = (uint8_t *)buffer + buffer_len - 5; diff = (uintptr_t)base / sizeof(wchar16_t); while (warrv && *warrv) { *arrv = (char *)(ch-(uintptr_t)base); wch = *warrv + diff; + /* ubound already accounts for null termination, see above */ while (*wch && (ch < ubound)) { if (*wch <= 0x7F) { /* from: 00000000 0xxxxxxx (little endian) */ |