hostname icon indicating copy to clipboard operation
hostname copied to clipboard

Handle posix hostname edge cases

Open stoeckmann opened this issue 4 years ago • 2 comments

  • 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

stoeckmann avatar Dec 04 '21 18:12 stoeckmann

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.

svartalf avatar Jan 05 '22 09:01 svartalf

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

stoeckmann avatar Jan 05 '22 20:01 stoeckmann