Fix mismatch between switch condition and case size

On macOS (and probably other BSDs), the sa_family member is 8 bits, so
comparing with 0xffff and other 16-bit values overflows. Cast to a wider
type to resolve the issue.
This commit is contained in:
dmiller 2026-09-19 02:26:42 +00:00
parent 6e5eb5f3a9
commit 9369f7a9df

View file

@ -302,7 +302,7 @@ addr_ston(const struct sockaddr *sa, struct addr *a)
memset(a, 0, sizeof(*a));
switch (sa->sa_family) {
switch ((unsigned int)sa->sa_family) {
#ifdef HAVE_NET_IF_DL_H
# ifdef AF_LINK
case AF_LINK: