git: 8afd77acc6b5 - stable/15 - bhyve: fix integer overflow in qXfer packet parser
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 06 Nov 2026 19:54:47 UTC
The branch stable/15 has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=8afd77acc6b514937873f5217a9e10b9c1a0a422
commit 8afd77acc6b514937873f5217a9e10b9c1a0a422
Author: Osvaldo Janeri Filho <ojanerif@amd.com>
AuthorDate: 2026-10-19 18:53:05 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-11-06 15:52:19 +0000
bhyve: fix integer overflow in qXfer packet parser
doff + dlen overflows unsigned int when both values are close to UINT_MAX,
causing the wrong branch to execute and passing an unbounded length to
append_binary_data(). Rewrite the comparison to avoid the addition.
Reviewed by: markj
Fixes: f81cdf24ba54 ("bhyve: Add support for XML register definitions")
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D60847
(cherry picked from commit 5ce0ab7355264d38fcde4684f0a64347ec0f5234)
---
usr.sbin/bhyve/gdb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/usr.sbin/bhyve/gdb.c b/usr.sbin/bhyve/gdb.c
index 983e7deb61c9..d137db643bae 100644
--- a/usr.sbin/bhyve/gdb.c
+++ b/usr.sbin/bhyve/gdb.c
@@ -1841,7 +1841,7 @@ gdb_query(const uint8_t *data, size_t len)
start_packet();
if (doff >= xmllen) {
append_char('l');
- } else if (doff + dlen >= xmllen) {
+ } else if (dlen >= xmllen - doff) {
append_char('l');
append_binary_data(xml + doff, xmllen - doff);
} else {