mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:48:10 +00:00
LibC: Return EINVAL from unsetenv()
if input is empty or contains "="
This commit is contained in:
parent
d3a27eeaf2
commit
b9e7998b53
1 changed files with 5 additions and 0 deletions
|
@ -431,6 +431,11 @@ char* secure_getenv(char const* name)
|
||||||
int unsetenv(char const* name)
|
int unsetenv(char const* name)
|
||||||
{
|
{
|
||||||
auto new_var_len = strlen(name);
|
auto new_var_len = strlen(name);
|
||||||
|
if (new_var_len == 0 || strchr(name, '=')) {
|
||||||
|
errno = EINVAL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
size_t environ_size = 0;
|
size_t environ_size = 0;
|
||||||
int skip = -1;
|
int skip = -1;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue