From: Alfred Agrell floating@muncher.se
--- dlls/ntdll/locale_private.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/locale_private.h b/dlls/ntdll/locale_private.h index 40d6ab0004d..3f82129790a 100644 --- a/dlls/ntdll/locale_private.h +++ b/dlls/ntdll/locale_private.h @@ -443,7 +443,11 @@ static inline NTSTATUS utf8_mbstowcs( WCHAR *dst, unsigned int dstlen, unsigned { res -= 0x10000; *dst++ = 0xd800 | (res >> 10); - if (dst == dstend) break; + if (dst == dstend) + { + status = STATUS_BUFFER_TOO_SMALL; + break; + } *dst++ = 0xdc00 | (res & 0x3ff); } else
From: Alfred Agrell floating@muncher.se
--- dlls/ntdll/tests/rtlstr.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/dlls/ntdll/tests/rtlstr.c b/dlls/ntdll/tests/rtlstr.c index ffd816265ac..3faf7b36a97 100644 --- a/dlls/ntdll/tests/rtlstr.c +++ b/dlls/ntdll/tests/rtlstr.c @@ -2548,6 +2548,7 @@ static void test_RtlUTF8ToUnicodeN(void) truncate_expect( 8, 4, STATUS_BUFFER_TOO_SMALL); truncate_expect( 9, 4, STATUS_BUFFER_TOO_SMALL); truncate_expect(10, 5, STATUS_SUCCESS); + unicode_expect(special_expected, 6, 3, special_string, 7, STATUS_BUFFER_TOO_SMALL); #undef truncate_expect
/* conversion behavior with varying input length */