mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Using putenv() and later direct pointer contents modification it is possibe
to craft environment variables with similar names like that:
a=1
a=2
...
unsetenv("a") should remove them all to make later getenv("a") impossible.
Fix it to do so (this is GNU autoconf test #3 failure too).
PR: 172273
MFC after: 1 week
This commit is contained in:
parent
4544286921
commit
2de80aea80
1 changed files with 3 additions and 1 deletions
|
|
@ -675,11 +675,13 @@ unsetenv(const char *name)
|
|||
|
||||
/* Deactivate specified variable. */
|
||||
envNdx = envVarsTotal - 1;
|
||||
if (__findenv(name, nameLen, &envNdx, true) != NULL) {
|
||||
/* Remove all occurrences. */
|
||||
while (__findenv(name, nameLen, &envNdx, true) != NULL) {
|
||||
envVars[envNdx].active = false;
|
||||
if (envVars[envNdx].putenv)
|
||||
__remove_putenv(envNdx);
|
||||
__rebuild_environ(envActive - 1);
|
||||
envNdx = envVarsTotal - 1;
|
||||
}
|
||||
|
||||
return (0);
|
||||
|
|
|
|||
Loading…
Reference in a new issue