env::vars panics if environ is null #53200
Labels
C-bug
Category: This is a bug.
O-linux
Operating system: Linux
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
The following code panics:
The problem is that env assumes that environ is not null. See Rust env implementation
The clearenv(3 ) function on linux is often implemented by freeing environ and setting it to null. See uclibc and glibc
In my opinion the stdlib could handle this more gracefully and return an empty iterator instead of panicking
The text was updated successfully, but these errors were encountered: