Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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...).



"May", but really, it's best for `setenv()` to leak.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: