git: 2f900cbc5fdf - main - ifconfig: Use strlcpy(3) instead of strncpy(3) for interface name
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 18 Jan 2026 08:28:12 UTC
The branch main has been updated by pouria:
URL: https://cgit.FreeBSD.org/src/commit/?id=2f900cbc5fdf1eaafd706936dc4ded7c49a23620
commit 2f900cbc5fdf1eaafd706936dc4ded7c49a23620
Author: Amy Vargas <amy.vargas@netapp.com>
AuthorDate: 2026-01-17 09:48:06 +0000
Commit: Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org>
CommitDate: 2026-01-18 08:26:39 +0000
ifconfig: Use strlcpy(3) instead of strncpy(3) for interface name
No functional change intended.
Reviewed by: pouria, delphij, imp
Approved by: glebius (mentor)
Differential Revision: https://reviews.freebsd.org/D54752
---
sbin/ifconfig/af_link.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sbin/ifconfig/af_link.c b/sbin/ifconfig/af_link.c
index 55b75d847c16..db7dbb0841dc 100644
--- a/sbin/ifconfig/af_link.c
+++ b/sbin/ifconfig/af_link.c
@@ -134,7 +134,7 @@ link_status(if_ctx *ctx, const struct ifaddrs *ifa)
sdl->sdl_alen != ETHER_ADDR_LEN)
return;
- strncpy(ifr.ifr_name, ifa->ifa_name, sizeof(ifr.ifr_name));
+ strlcpy(ifr.ifr_name, ifa->ifa_name, sizeof(ifr.ifr_name));
memcpy(&ifr.ifr_addr, ifa->ifa_addr, sizeof(ifa->ifa_addr->sa_len));
ifr.ifr_addr.sa_family = AF_LOCAL;
if ((sock_hw = socket(AF_LOCAL, SOCK_DGRAM, 0)) < 0) {