don't let hexify call strlen

hexify had the same issue as bin2hex; and the fix is the same.

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>

	* remote-utils.c (monitor_output): Pass explicit length to
	hexify.
This commit is contained in:
Tom Tromey 2014-01-18 19:25:57 -07:00
parent 9f1b45b0da
commit 0a822afbcd
4 changed files with 12 additions and 6 deletions

View file

@ -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);