git: d0b11d55ee0f - stable/15 - linuxkpi: Fix strlcpy size in linuxkpi_alloc_netdev()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 30 Apr 2026 16:28:08 UTC
The branch stable/15 has been updated by emaste:
URL: https://cgit.FreeBSD.org/src/commit/?id=d0b11d55ee0fb3d1d2d36df9f3ecd95a47a08cf2
commit d0b11d55ee0fb3d1d2d36df9f3ecd95a47a08cf2
Author: Weixie Cui <cuiweixie@gmail.com>
AuthorDate: 2026-03-31 10:21:30 +0000
Commit: Ed Maste <emaste@FreeBSD.org>
CommitDate: 2026-04-30 16:27:55 +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
(cherry picked from commit edb302bb49e00723030b84624f16217f18760564)
---
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. */