This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[commit] ui-out.c, ui_out_field_core_addr, make safe from overflow
- From: Michael Snyder <msnyder at vmware dot com>
- To: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Mon, 28 Feb 2011 18:34:27 -0800
- Subject: [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))