...
Wiki Markup |
---|
However, modifying the environment by using the {{setenv()}} or {{putenv()}} functions, or by any other means, may cause the environment memory to be reallocated, with the result that {{envp}} now references an incorrect location. For example, POSIX.1-2008 says the following \[[AustinOpen Group 0804|AA. C References#AustinReferences#Open Group 0804]\] |
Unanticipated results may occur if
setenv()
changes the external variableenviron
. In particular, if the optionalenvp
argument tomain()
is present, it is not changed, and thus may point to an obsolete copy of the environment (as may any other copy ofenviron
).
...
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
References
Wiki Markup |
---|
\[[Austin Group 08|AA. C References#Austin Group 08]\] vol. 2, System Interfaces, {{setenv()}} \[[ISO/IEC 9899-1999|AA. C References#ISO/IEC 9899-1999]\] Section J.5.1, "Environment Arguments" \[[Open Group 04|AA. C References#Open Group 04]\] [{{setenv()}}|http://www.opengroup.org/onlinepubs/009695399/functions/setenv.html] |
...
ENV30-C. Do not modify the string returned by getenv() 10. Environment (ENV) ENV32-C. No atexit handler should terminate in any way other than by returning