Handle posix hostname edge cases
- Consider nul byte in posix code
- Prevent integer overflows (get and set) in posix code
Proof of Concept: If you set your hostname to a 64 character long string in Linux then a test fails. :)
Shoutout to @c3h2_ctf
Thank you for this PR, changes look solid!
If you set your hostname to a 64 character long string in Linux then a test fails. :)
Would it also be possible to cover that case with the test? It, of course, looks like a platform-dependant change due to dependency on _SC_HOST_NAME_MAX, but it still seems like a thing we want to get covered.
Would it also be possible to cover that case with the test?
Generally yes, but it would imply that we modify the hostname. This in turn means that we would need proper permissions while running the tests. Or it would take some form of mocking. Not sure if it's worth it (or how to get the mocking done with Rust, to be honest).