1
0
mirror of https://github.com/valinet/ExplorerPatcher.git synced 2024-11-15 11:33:16 +01:00

Utility: Fixed bug in rand_string

This commit is contained in:
Valentin Radu 2022-02-17 22:50:11 +02:00
parent c00de82cd6
commit d5b63319f0

View File

@ -268,7 +268,7 @@ static inline WCHAR* rand_string(WCHAR* str, size_t size)
if (size) { if (size) {
--size; --size;
for (size_t n = 0; n < size; n++) { 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[n] = charset[key];
} }
str[size] = L'\0'; str[size] = L'\0';