From 9971ac47821cb9165226be0c520fc5388cbc97fc Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Mon, 10 Mar 2008 12:36:08 +0000 Subject: [PATCH] 2008-03-10 Hidetaka Takano * spu-tdep.c (info_spu_event_command): Insert a '\0' to the end of the data passing to strtoulst function. (info_spu_signal_command): Likewise. --- gdb/ChangeLog | 6 ++++++ gdb/spu-tdep.c | 12 ++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d37519132fd..f28f62af9a3 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2008-03-10 Hidetaka Takano + + * spu-tdep.c (info_spu_event_command): Insert a '\0' to the end + of the data passing to strtoulst function. + (info_spu_signal_command): Likewise. + 2008-03-08 Vladimir Prus * mi/mi-interp.c (mi_command_loop): Remove diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c index 9fcb1185928..882b6135351 100644 --- a/gdb/spu-tdep.c +++ b/gdb/spu-tdep.c @@ -1505,16 +1505,18 @@ info_spu_event_command (char *args, int from_tty) xsnprintf (annex, sizeof annex, "%d/event_status", id); len = target_read (¤t_target, TARGET_OBJECT_SPU, annex, - buf, 0, sizeof buf); + buf, 0, (sizeof (buf) - 1)); if (len <= 0) error (_("Could not read event_status.")); + buf[len] = '\0'; event_status = strtoulst (buf, NULL, 16); xsnprintf (annex, sizeof annex, "%d/event_mask", id); len = target_read (¤t_target, TARGET_OBJECT_SPU, annex, - buf, 0, sizeof buf); + buf, 0, (sizeof (buf) - 1)); if (len <= 0) error (_("Could not read event_mask.")); + buf[len] = '\0'; event_mask = strtoulst (buf, NULL, 16); chain = make_cleanup_ui_out_tuple_begin_end (uiout, "SPUInfoEvent"); @@ -1565,9 +1567,10 @@ info_spu_signal_command (char *args, int from_tty) xsnprintf (annex, sizeof annex, "%d/signal1_type", id); len = target_read (¤t_target, TARGET_OBJECT_SPU, annex, - buf, 0, sizeof buf); + buf, 0, (sizeof (buf) - 1)); if (len <= 0) error (_("Could not read signal1_type.")); + buf[len] = '\0'; signal1_type = strtoulst (buf, NULL, 16); xsnprintf (annex, sizeof annex, "%d/signal2", id); @@ -1582,9 +1585,10 @@ info_spu_signal_command (char *args, int from_tty) xsnprintf (annex, sizeof annex, "%d/signal2_type", id); len = target_read (¤t_target, TARGET_OBJECT_SPU, annex, - buf, 0, sizeof buf); + buf, 0, (sizeof (buf) - 1)); if (len <= 0) error (_("Could not read signal2_type.")); + buf[len] = '\0'; signal2_type = strtoulst (buf, NULL, 16); chain = make_cleanup_ui_out_tuple_begin_end (uiout, "SPUInfoSignal"); -- 2.30.2