diff options
author | green <green@FreeBSD.org> | 2003-12-26 18:09:35 +0000 |
---|---|---|
committer | green <green@FreeBSD.org> | 2003-12-26 18:09:35 +0000 |
commit | 0c878eef027c8107cc08f8198c283e3abeb31c53 (patch) | |
tree | ee885881036e32c846bc221d47e1916e8e560f4b | |
parent | 11930a9c8cd405e9cf40384f3e059d6c00118835 (diff) | |
download | FreeBSD-src-0c878eef027c8107cc08f8198c283e3abeb31c53.zip FreeBSD-src-0c878eef027c8107cc08f8198c283e3abeb31c53.tar.gz |
Don't truncate the interface name in ifunit(). It's now possible to query
"very long interface names", e.g.:
ndis_atheros0: flags=8847<UP,BROADCAST,DEBUG,RUNNING,SIMPLEX,MULTICAST> mtu 1500
-rw-r--r-- | sys/net/if.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index 447e4a1..6453be4 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1229,7 +1229,7 @@ if_slowtimo(void *arg) struct ifnet * ifunit(const char *name) { - char namebuf[IFNAMSIZ + 1]; + char namebuf[IFNAMSIZ + sizeof("net")]; /* XXX net_cdevsw.d_name */ struct ifnet *ifp; dev_t dev; @@ -1241,7 +1241,7 @@ ifunit(const char *name) * XXX * Devices should really be known as /dev/fooN, not /dev/net/fooN. */ - snprintf(namebuf, IFNAMSIZ, "%s/%s", net_cdevsw.d_name, name); + snprintf(namebuf, sizeof(namebuf), "%s/%s", net_cdevsw.d_name, name); IFNET_RLOCK(); TAILQ_FOREACH(ifp, &ifnet, if_link) { dev = ifdev_byindex(ifp->if_index); |