1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:24:57 +00:00

LibC: Return EINVAL from unsetenv() if input is empty or contains "="

This commit is contained in:
Tim Ledbetter 2023-06-25 11:48:40 +01:00 committed by Andreas Kling
parent d3a27eeaf2
commit b9e7998b53

View file

@ -431,6 +431,11 @@ char* secure_getenv(char const* name)
int unsetenv(char const* name)
{
auto new_var_len = strlen(name);
if (new_var_len == 0 || strchr(name, '=')) {
errno = EINVAL;
return -1;
}
size_t environ_size = 0;
int skip = -1;