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]

[commit] ui-out.c, ui_out_field_core_addr, make safe from overflow


checked in.

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

	* ui-out.c (ui_out_field_core_addr): Make local char buffer
	a little bigger, to avoid possibility of an overflow.

Index: ui-out.c
===================================================================
RCS file: /cvs/src/src/gdb/ui-out.c,v
retrieving revision 1.52
diff -u -p -u -p -r1.52 ui-out.c
--- ui-out.c	28 Feb 2011 15:21:21 -0000	1.52
+++ ui-out.c	1 Mar 2011 02:29:17 -0000
@@ -492,7 +492,9 @@ ui_out_field_core_addr (struct ui_out *u
 			struct gdbarch *gdbarch,
 			CORE_ADDR address)
 {
-  char addstr[20];
+  /* Maximum size string returned by hex_string_custom is 50 chars.
+     This buffer must be bigger than that, for safety.  */
+  char addstr[64];
   int addr_bit = gdbarch_addr_bit (gdbarch);
 
   if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))

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