[prev in list] [next in list] [prev in thread] [next in thread]
List: wine-cvs
Subject: =?UTF-8?Q?Alexandre_Julliard_=3A_ntdll=3A_Fix_memory_corruption_in_RtlNor?= =?UTF-8?Q?malizeString=2
From: Alexandre Julliard <julliard () winehq ! org>
Date: 2019-12-27 21:47:36
Message-ID: E1ikxSK-0005kR-Sf () winehq ! org
[Download RAW message or body]
Module: wine
Branch: master
Commit: ddb6f150e1175287574f4561e9661dda97eab330
URL: https://source.winehq.org/git/wine.git/?a=commit;h=ddb6f150e1175287574f4561e9661dda97eab330
Author: Alexandre Julliard <julliard@winehq.org>
Date: Fri Dec 27 17:58:34 2019 +0100
ntdll: Fix memory corruption in RtlNormalizeString().
Signed-off-by: Alexandre Julliard <julliard@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)
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic