git: e1ab35148dd4 - main - netmap: Don't assume that user-provided strings are nul-terminated
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 09 Jul 2026 13:41:43 UTC
The branch main has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=e1ab35148dd425340a88a2acaf10b972cb119f8f
commit e1ab35148dd425340a88a2acaf10b972cb119f8f
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2026-07-08 17:11:05 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-07-09 13:41:19 +0000
netmap: Don't assume that user-provided strings are nul-terminated
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
---
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) {