coreutils/src/uu/pinky
Justin Tracey 5e7d58650d fix null pointer derefs
The code for creating a Passwd from the fields of the raw syscall result
assumed that the syscall would return valid C strings in all non-error
cases. This is not true, and at least one platform (Android) will
populate the fields with null pointers where they are not supported.

To fix this and prevent the error from happening again, this commit
changes `cstr2string(ptr)` to check for a null pointer, and return an
`Option<String>`, with `None` being the null pointer case. While
arguably it should be the caller's job to check for a null pointer
before calling (since the safety precondition is that the pointer is to
a valid C string), relying on the type checker to force remembering this
edge case is safer in the long run.
2022-04-20 08:44:49 +02:00
..
src fix null pointer derefs 2022-04-20 08:44:49 +02:00
Cargo.toml Change edition to 2021 2022-04-05 10:39:31 +02:00
LICENSE Include license text in all published crates 2022-03-05 21:21:46 +01:00