From 7d2fb9027485580f644b2150a57e634bcefd2165 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Damien?= Date: Tue, 17 Mar 2026 19:46:51 +0100 Subject: [PATCH] fix(string): generate random name size in the correct range The previous implementation may generate value outside the range and was not uniform. --- string/StringObfuscation.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/string/StringObfuscation.cpp b/string/StringObfuscation.cpp index ca15028..1bdf6dc 100644 --- a/string/StringObfuscation.cpp +++ b/string/StringObfuscation.cpp @@ -134,7 +134,8 @@ std::string StringObfuscatorPass::generateRandomName() { auto charsetSize = strlen(ALPHANUM) - 1; auto size = - MIN(cryptoutils->get_uint8_t() + RandomNameMinSize, RandomMaxNameSize); + cryptoutils->get_range(RandomMaxNameSize - RandomNameMinSize) + + RandomNameMinSize; for (unsigned int i = 0; i < size; i++) { auto index = cryptoutils->get_range(charsetSize); name += ALPHANUM[index];