git: 0952943a680d - main - netstat: Fix -ia missing multicast addresses on some interfaces
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 03 Oct 2025 14:32:22 UTC
The branch main has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=0952943a680dca12fe8f65f8813a9dca0783ce88
commit 0952943a680dca12fe8f65f8813a9dca0783ce88
Author: Nick Reilly <nreilly@qnx.com>
AuthorDate: 2025-09-12 19:27:59 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2025-10-03 14:32:09 +0000
netstat: Fix -ia missing multicast addresses on some interfaces
sdl_data isn't always NULL terminated
Signed-off-by: nreilly@qnx.com
PR: 288958
Reviewed by: markj
MFC after: 1 week
---
usr.bin/netstat/if.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/usr.bin/netstat/if.c b/usr.bin/netstat/if.c
index 622141e4ff69..7ee03eb3689b 100644
--- a/usr.bin/netstat/if.c
+++ b/usr.bin/netstat/if.c
@@ -282,7 +282,8 @@ next_ifma(struct ifmaddrs *ifma, const char *name, const sa_family_t family)
sdl = (struct sockaddr_dl *)ifma->ifma_name;
if (ifma->ifma_addr->sa_family == family &&
- strcmp(sdl->sdl_data, name) == 0)
+ sdl->sdl_nlen == strlen(name) &&
+ strncmp(sdl->sdl_data, name, sdl->sdl_nlen) == 0)
break;
}