git: ce1dc2df8019 - main - netmap: bdg: replace strncpy with safer strlcpy

From: Vincenzo Maffione <vmaffione_at_FreeBSD.org>
Date: Sun, 01 Nov 2026 18:01:36 UTC
The branch main has been updated by vmaffione:

URL: https://cgit.FreeBSD.org/src/commit/?id=ce1dc2df8019733f320b7338f8cf736faf0ffa5d

commit ce1dc2df8019733f320b7338f8cf736faf0ffa5d
Author:     Vincenzo Maffione <vmaffione@FreeBSD.org>
AuthorDate: 2026-11-01 17:53:47 +0000
Commit:     Vincenzo Maffione <vmaffione@FreeBSD.org>
CommitDate: 2026-11-01 18:00:09 +0000

    netmap: bdg: replace strncpy with safer strlcpy
    
    Submitted by:   Brian Poole <brian90013@gmail.com>
---
 sys/dev/netmap/netmap_bdg.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/dev/netmap/netmap_bdg.c b/sys/dev/netmap/netmap_bdg.c
index 1fe5052448f8..a74a6d218957 100644
--- a/sys/dev/netmap/netmap_bdg.c
+++ b/sys/dev/netmap/netmap_bdg.c
@@ -215,7 +215,8 @@ nm_find_bridge(const char *name, int create, struct netmap_bdg_ops *ops)
 			nm_prerr("failed to allocate hash table");
 			return NULL;
 		}
-		strncpy(b->bdg_basename, name, namelen);
+		strlcpy(b->bdg_basename, name, sizeof(b->bdg_basename));
+		b->bdg_basename[namelen] = '\0';
 		b->bdg_namelen = namelen;
 		b->bdg_active_ports = 0;
 		for (i = 0; i < NM_BDG_MAXPORTS; i++)