mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-28 11:25:21 +01:00
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:f81cdf24ba("bhyve: Add support for XML register definitions") MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D60847 (cherry picked from commit5ce0ab7355)
This commit is contained in:
1 parent
a5f61370a3
commit
d5d386df28
1 file changed
+1
-1
@@ -1695,7 +1695,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 {
|
||||
|
||||
Reference in new issue
Block a user