DragonFlyBSD Kernel Audit
DF-1080 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/cpu/x86_64/misc/x86_64-gdbstub.c b/sys/cpu/x86_64/misc/x86_64-gdbstub.c
--- a/sys/cpu/x86_64/misc/x86_64-gdbstub.c
+++ b/sys/cpu/x86_64/misc/x86_64-gdbstub.c
@@ -566,7 +566,7 @@
 
 	    if (hexToInt (&ptr, &regno)
 		&& *ptr++ == '='
-		&& regno < NUM_REGS)
+		&& regno >= 0 && regno < NUM_REGS && regno < (int)(NUMREGBYTES/8))
 	      {
 		/* JG */
 		hex2mem (ptr, (vm_offset_t)&registers + regno * 8, 8);