Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
common: fix segfault in public IPv6 addr picking #14124
sockaddr is only 16 bytes big, so declaring net as sockaddr
using sockaddr_storage works for both IPv4 and IPv6, and is
note that the tests did not find this issue as they declared
Signed-off-by: Fabian Grünbichler firstname.lastname@example.org
ugh - sorry for missing that the unit tests don't run automatically on build (and thus not rechecking the test changes before submitting).
obviously casting (struct sockaddr_in *) to (struct sockaddr_storage *) can't work since parse_networks will memset the whole "sockaddr_storage" to 0. so we need to always call parse_networks with an actual sockaddr_storage, and later cast that to whatever we expect (test case) or it contains (actual usage).
TL;DR: unit tests pass now, actual code remains unchanged