Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Some environments provide environment pointers that are valid when main() is called, but may be invalided by operations that modify the environment.

Section J.5.1 of the C standard Standard [ISO/IEC 9899:2011] states:

...

The environment block passed to main and wmain is a "frozen" copy of the current environment. If you subsequently change the environment via a call to _putenv or _wputenv, the current environment (as returned by getenv / _wgetenv and the _environ / _wenviron variable) will change, but the block pointed to by envp will not change.

...

Search for vulnerabilities resulting from the violation of this rule on the CERT website.

Related Guidelines

...

Bibliography

...

]Section J.5.1, "Environment

...

Arguments"

...

...

...

...