1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 15:47:34 +00:00

Tests: Un-flake the recent TestEnvironment addition

Depending on stack values being correctly and deterministically
overwritten was a bit too optimistic, to be honest. This new logic uses
a value on the heap.
This commit is contained in:
Jelle Raaijmakers 2023-06-06 11:54:20 +02:00 committed by Andreas Kling
parent 2cd4f135f0
commit 162a2b66eb
2 changed files with 13 additions and 29 deletions

View file

@ -502,7 +502,7 @@ int putenv(char* new_var)
auto old_var_name_max_length = strnlen(old_var, new_var_name_len);
char* old_eq = static_cast<char*>(memchr(old_var, '=', old_var_name_max_length + 1));
if (!old_eq)
continue; // possibly freed or overwritten value
continue; // name is longer, or possibly freed or overwritten value
auto old_var_name_len = old_eq - old_var;
if (new_var_name_len != old_var_name_len)