From d5b63319f0701f0b812a3680bb12041161b64915 Mon Sep 17 00:00:00 2001 From: Valentin Radu Date: Thu, 17 Feb 2022 22:50:11 +0200 Subject: [PATCH] Utility: Fixed bug in `rand_string` --- ExplorerPatcher/utility.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ExplorerPatcher/utility.h b/ExplorerPatcher/utility.h index a8bcdec..77203d6 100644 --- a/ExplorerPatcher/utility.h +++ b/ExplorerPatcher/utility.h @@ -268,7 +268,7 @@ static inline WCHAR* rand_string(WCHAR* str, size_t size) if (size) { --size; for (size_t n = 0; n < size; n++) { - int key = rand() % (int)(sizeof charset - 1); + int key = rand() % (int)((sizeof(charset) / sizeof(WCHAR)) - 1); str[n] = charset[key]; } str[size] = L'\0';