From 9fe1ff016571c86dea3d3cbcd9183417d44dc480 Mon Sep 17 00:00:00 2001 From: akallabeth Date: Wed, 7 Aug 2024 09:33:28 +0200 Subject: [PATCH] fix #10446 --- winpr/libwinpr/registry/registry.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/winpr/libwinpr/registry/registry.c b/winpr/libwinpr/registry/registry.c index 7422d8ba3..46a6ee32d 100644 --- a/winpr/libwinpr/registry/registry.c +++ b/winpr/libwinpr/registry/registry.c @@ -385,11 +385,13 @@ LONG RegQueryValueExW(HKEY hKey, LPCWSTR lpValueName, LPDWORD lpReserved, LPDWOR case REG_DWORD_BIG_ENDIAN: case REG_QWORD: case REG_DWORD: - return reg_read_int(pValue, lpData, lpcbData); + status = reg_read_int(pValue, lpData, lpcbData); + goto end; case REG_SZ: { const size_t length = strnlen(pValue->data.string, UINT32_MAX) * sizeof(WCHAR); + status = ERROR_SUCCESS; if (lpData != NULL) { DWORD size = 0; @@ -404,14 +406,13 @@ LONG RegQueryValueExW(HKEY hKey, LPCWSTR lpValueName, LPDWORD lpReserved, LPDWOR size = *lpcbData; *lpcbData = (DWORD)length; if (size < length) - return ERROR_MORE_DATA; + status = ERROR_MORE_DATA; if (ConvertUtf8NToWChar(pValue->data.string, length, cnv.wc, length) < 0) - return ERROR_OUTOFMEMORY; + status = ERROR_OUTOFMEMORY; } else if (lpcbData) *lpcbData = (UINT32)length; - status = ERROR_SUCCESS; goto end; } default: