Re: git: edb302bb49e0 - main - linuxkpi: Fix strlcpy size in linuxkpi_alloc_netdev()
Date: Wed, 22 Apr 2026 22:09:32 UTC
On Wed, 22 Apr 2026, Pouria Mousavizadeh Tehrani wrote: > The branch main has been updated by pouria: > > URL: https://cgit.FreeBSD.org/src/commit/?id=edb302bb49e00723030b84624f16217f18760564 > > commit edb302bb49e00723030b84624f16217f18760564 > Author: Weixie Cui <cuiweixie@gmail.com> > AuthorDate: 2026-03-31 10:21:30 +0000 > Commit: Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org> > CommitDate: 2026-04-22 20:51:48 +0000 > > linuxkpi: Fix strlcpy size in linuxkpi_alloc_netdev() > > `sizeof(*ndev->name)` is `sizeof(char)`, not IFNAMSIZ, so > the interface name was effectively limited to a single byte. > Use `sizeof(ndev->name)` for the `char name[IFNAMSIZ]` member. > > Signed-off-by: Weixie Cui <cuiweixie@gmail.com> > Reviewed by: pouria > Pull-Request: https://github.com/freebsd/freebsd-src/pull/2111 Fixes: d105895844848 Thanks! > --- > sys/compat/linuxkpi/common/src/linux_netdev.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sys/compat/linuxkpi/common/src/linux_netdev.c b/sys/compat/linuxkpi/common/src/linux_netdev.c > index ce9153614104..11bbbfe6e279 100644 > --- a/sys/compat/linuxkpi/common/src/linux_netdev.c > +++ b/sys/compat/linuxkpi/common/src/linux_netdev.c > @@ -405,7 +405,7 @@ linuxkpi_alloc_netdev(size_t len, const char *name, uint32_t flags, > /* Always first as it zeros! */ > linuxkpi_init_dummy_netdev(ndev); > > - strlcpy(ndev->name, name, sizeof(*ndev->name)); > + strlcpy(ndev->name, name, sizeof(ndev->name)); > > /* This needs extending as we support more. */ > > > -- Bjoern A. Zeeb r15:7