Skip to content
Commit aa0479fc authored by Harald Sitter's avatar Harald Sitter 🐧
Browse files

use std::array for the hostname buf instead of raw pointer

size is NI_MAXHOST which is available on both linux and freebsd
according to the respective manpages.

also pass the array into the helper function such that we can then pass
the array's size() to the getnameinfo function instead of having to
repeat ourselves (that should have really been a sizeof in the first
place TBH).

this also fixes a bug where we could segv in the
`!HAVE_STRUCT_SOCKADDR_SA_LEN` branch because the buffer was only 128
but we'd tell getnameinfo it is NI_MAXHOST (which is 1025 on linux)

also, zeroing out now happens inside getNameInfo instead of repeating
ourselves on the caller side. this is now using the builtin fill
function of std::array instead of bzero, it's more c++-ish this way.
parent 42be1098
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment