Skip to content

Commit 77edceb

Browse files
authored
Merge pull request #1441 from WebPlatformForEmbedded/pgorszkowski/2.38/secure_env_var_bmalloc_microseconds_sleep
Secure parsing of WEBKIT_WPE_BMALLOC_MICROSECONDS_SLEEP env var
2 parents d796615 + e77a5d7 commit 77edceb

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Source/bmalloc/bmalloc/Mutex.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <mach/mach_traps.h>
3232
#include <mach/thread_switch.h>
3333
#endif
34+
#include <cstring>
3435
#include <thread>
3536
#include <unistd.h>
3637

@@ -46,7 +47,7 @@ static inline void yield()
4647
static std::once_flag onceFlag;
4748
std::call_once(onceFlag, [] {
4849
const char* env = getenv("WEBKIT_WPE_BMALLOC_MICROSECONDS_SLEEP");
49-
if (env) {
50+
if (env && env[strnlen(env, 5)] == '\0') {
5051
int value;
5152
if (sscanf(env, "%d", &value) == 1 && value > 0)
5253
bmallocMicrosecondsSleep = value;

0 commit comments

Comments
 (0)