News for hackers. Stuff that matters.
Re:Getaddrinfo() on glibc calls getenv(), oh boy by cryptonector on Tuesday October 17, 2023 @02:20AM (#37911279)
`getenv()` never returns pointers that can be invalidated. If you `putenv()` something, you commit to never freeing it or overwriting it.
Re:Getaddrinfo() on glibc calls getenv(), oh boy by hddqsb on Tuesday October 17, 2023 @05:14AM (#37912376)
Good point about `putenv()`; however there is also `setenv()`, which does make a copy, so you are wrong about `getenv()` in general.

POSIX explicitly states "The string [returned by getenv] may be overwritten by a subsequent call to getenv(), setenv(), unsetenv(), or putenv()" (https://pubs.opengroup.org/onlinepubs/9699919799.2008edition...).

Re:Getaddrinfo() on glibc calls getenv(), oh boy by cryptonector on Tuesday October 17, 2023 @11:31AM (#37916719)
"May", but really, it's best for `setenv()` to leak.