git: 6894d9a74aa1 - stable/14 - netmap: Don't assume that user-provided strings are nul-terminated
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 27 Jul 2026 22:32:35 UTC
The branch stable/14 has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=6894d9a74aa1c588d77c131568bd87571bd15316
commit 6894d9a74aa1c588d77c131568bd87571bd15316
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2026-07-08 17:11:05 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-07-27 14:05:07 +0000
netmap: Don't assume that user-provided strings are nul-terminated
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
(cherry picked from commit e1ab35148dd425340a88a2acaf10b972cb119f8f)
---
sys/dev/netmap/netmap_bdg.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/sys/dev/netmap/netmap_bdg.c b/sys/dev/netmap/netmap_bdg.c
index bcb45f55d160..1fe5052448f8 100644
--- a/sys/dev/netmap/netmap_bdg.c
+++ b/sys/dev/netmap/netmap_bdg.c
@@ -1043,6 +1043,10 @@ netmap_bdg_config(struct nm_ifreq *nr)
struct nm_bridge *b;
int error = EINVAL;
+ if (strnlen(nr->nifr_name, sizeof(nr->nifr_name)) >=
+ sizeof(nr->nifr_name))
+ return error;
+
NMG_LOCK();
b = nm_find_bridge(nr->nifr_name, 0, NULL);
if (!b) {