...
If the string returned by getenv()
must be altered, a local copy should be created. Altering the string returned by getenv()
results in undefined behavior 184 of Annex J of the C Standard.
Similarly, subclause 7.11.1.1, paragraph 8 [ISO/IEC 9899:2011], defines setlocale()
as follows:
...
Altering the string returned by setlocale()
or the structure returned by localeconv()
results in undefined behaviors 120 and 121 of Annex J. Furthermore, the C Standard imposes no requirements on the contents of the string by setlocale()
. Consequently, no assumptions can be made as to the string's internal contents or structure.
...
Altering the string returned by strerror()
results in undefined behavior 184 of Annex J.
Noncompliant Code Example (getenv()
)
...