Module: wine Branch: master Commit: 63ca94c4199d17b28b82a3f7165bb223703fafc9 URL: http://source.winehq.org/git/wine.git/?a=commit;h=63ca94c4199d17b28b82a3f716...
Author: Alexandre Julliard julliard@winehq.org Date: Thu Nov 9 12:03:21 2006 +0100
kernel32: Fixed buffer overrun in get_registry_locale_info.
---
dlls/kernel32/locale.c | 17 ++++++++++------- 1 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/dlls/kernel32/locale.c b/dlls/kernel32/locale.c index dd687ed..9a72a4c 100644 --- a/dlls/kernel32/locale.c +++ b/dlls/kernel32/locale.c @@ -804,7 +804,6 @@ static INT get_registry_locale_info( LPC }
status = NtQueryValueKey( hkey, &nameW, KeyValuePartialInformation, info, size, &size ); - if (status == STATUS_BUFFER_OVERFLOW && !buffer) status = 0;
if (!status) { @@ -825,14 +824,18 @@ static INT get_registry_locale_info( LPC buffer[ret-1] = 0; } } + else if (status == STATUS_BUFFER_OVERFLOW && !buffer) + { + ret = (size - info_size) / sizeof(WCHAR) + 1; + } + else if (status == STATUS_OBJECT_NAME_NOT_FOUND) + { + ret = -1; + } else { - if (status == STATUS_OBJECT_NAME_NOT_FOUND) ret = -1; - else - { - SetLastError( RtlNtStatusToDosError(status) ); - ret = 0; - } + SetLastError( RtlNtStatusToDosError(status) ); + ret = 0; } NtClose( hkey ); HeapFree( GetProcessHeap(), 0, info );