diff options
-rw-r--r-- | gdb/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/common/rsp-low.c | 4 | ||||
-rw-r--r-- | gdb/gdbserver/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/gdbserver/remote-utils.c | 5 |
4 files changed, 12 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e1dfbbb..e8521c9 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,9 @@ 2014-02-12 Tom Tromey <tromey@redhat.com> + * common/rsp-low.c (hexify): Never take strlen of argument. + +2014-02-12 Tom Tromey <tromey@redhat.com> + * common/rsp-low.c (bin2hex): Never take strlen of argument. * remote.c (extended_remote_run, remote_rcmd) (remote_download_trace_state_variable, remote_save_trace_data) diff --git a/gdb/common/rsp-low.c b/gdb/common/rsp-low.c index 7f0445c..fd6f563 100644 --- a/gdb/common/rsp-low.c +++ b/gdb/common/rsp-low.c @@ -177,10 +177,6 @@ hexify (char *hex, const char *bin, int count) { int i; - /* May use a length, or a nul-terminated string as input. */ - if (count == 0) - count = strlen (bin); - for (i = 0; i < count; i++) { *hex++ = tohex ((*bin >> 4) & 0xf); diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 7bf4a0f..35303df 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,5 +1,10 @@ 2014-02-12 Tom Tromey <tromey@redhat.com> + * remote-utils.c (monitor_output): Pass explicit length to + hexify. + +2014-02-12 Tom Tromey <tromey@redhat.com> + * tracepoint.c: Include rsp-low.h. * server.c: Include rsp-low.h. * remote-utils.h (convert_ascii_to_int, convert_int_to_ascii) diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c index b835175..8fd7c4a 100644 --- a/gdb/gdbserver/remote-utils.c +++ b/gdb/gdbserver/remote-utils.c @@ -1558,10 +1558,11 @@ relocate_instruction (CORE_ADDR *to, CORE_ADDR oldloc) void monitor_output (const char *msg) { - char *buf = xmalloc (strlen (msg) * 2 + 2); + int len = strlen (msg); + char *buf = xmalloc (len * 2 + 2); buf[0] = 'O'; - hexify (buf + 1, msg, 0); + hexify (buf + 1, msg, len); putpkt (buf); free (buf); |