⬢ DragonFlyBSD Kernel Audit
DF-5726 / fix.diff
← back to finding ↓ download raw
--- a/sys/ddb/db_break.c	2026-06-29 12:51:18.000000000 +0000
+++ b/sys/ddb/db_break.c	2026-10-10 18:39:43.915899474 +0000
@@ -274,6 +286,15 @@
 	if (count == -1)
 	    count = 1;
 
+	/*
+	 * struct db_breakpoint stores the skip count as int; reject counts
+	 * that would be silently truncated or that can never reach zero
+	 * (a zero or negative count makes --bkpt->count miss 0 forever,
+	 * silently disarming the breakpoint).
+	 */
+	if (count < 1 || count > INT_MAX)
+	    db_error("breakpoint: skip count out of range\n");
+
 	db_set_breakpoint(db_map_addr(addr), (db_addr_t)addr, count);
 }