Alexandre Julliard : ntdll: Fix memory corruption in RtlNormalizeString().
Alexandre Julliard
julliard at winehq.org
Fri Dec 27 15:47:36 CST 2019
Module: wine
Branch: master
Commit: ddb6f150e1175287574f4561e9661dda97eab330
URL: https://source.winehq.org/git/wine.git/?a=commit;h=ddb6f150e1175287574f4561e9661dda97eab330
Author: Alexandre Julliard <julliard at winehq.org>
Date: Fri Dec 27 17:58:34 2019 +0100
ntdll: Fix memory corruption in RtlNormalizeString().
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntdll/locale.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/dlls/ntdll/locale.c b/dlls/ntdll/locale.c
index e3f562808b..7e85f344dd 100644
--- a/dlls/ntdll/locale.c
+++ b/dlls/ntdll/locale.c
@@ -1585,20 +1585,14 @@ NTSTATUS WINAPI RtlNormalizeString( ULONG form, const WCHAR *src, INT src_len, W
else
{
buf_len = src_len * 4;
- do
+ for (;;)
{
- WCHAR *old_buf = buf;
-
- if (!buf) buf = RtlAllocateHeap( GetProcessHeap(), 0, buf_len );
- else buf = RtlReAllocateHeap( GetProcessHeap(), 0, buf, buf_len );
- if (!buf)
- {
- RtlFreeHeap( GetProcessHeap(), 0, old_buf );
- return STATUS_NO_MEMORY;
- }
+ buf = RtlAllocateHeap( GetProcessHeap(), 0, buf_len * sizeof(WCHAR) );
+ if (!buf) return STATUS_NO_MEMORY;
res = wine_decompose_string( flags, src, src_len, buf, buf_len );
+ if (res) break;
buf_len *= 2;
- } while (!res);
+ }
}
if (compose)
More information about the wine-cvs
mailing list