This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA] off by one array reference in i386-low.c/i386_show_dr


Doug,

I'm not 100 percent sure this is right, but I do know that
as written, it will overflow the array dr_mirror.  What do
you think?

Thanks,
Michael

2011-02-26  Michael Snyder  <msnyder@vmware.com>

	* i386-low.c (i386_show_dr): Fix off-by-one array reference.

Index: i386-low.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/i386-low.c,v
retrieving revision 1.5
diff -u -p -u -p -r1.5 i386-low.c
--- i386-low.c	1 Jan 2011 15:33:24 -0000	1.5
+++ i386-low.c	26 Feb 2011 22:48:38 -0000
@@ -195,7 +195,7 @@ i386_show_dr (struct i386_debug_reg_stat
 \tDR%d: addr=0x%s, ref.count=%d  DR%d: addr=0x%s, ref.count=%d\n",
 	      i, paddress (state->dr_mirror[i]),
 	      state->dr_ref_count[i],
-	      i + 1, paddress (state->dr_mirror[i + 1]),
+	      i + 1, paddress (state->dr_mirror[i]),
 	      state->dr_ref_count[i + 1]);
       i++;
     }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]