* printcmd.c (printf_command): Guard against 0-length string.

----------------------------------------------------------------------
This commit is contained in:
Michael Snyder 2000-07-24 18:13:27 +00:00
parent 39da812840
commit 7b92f6e1a2

View File

@ -2331,7 +2331,8 @@ printf_command (arg, from_tty)
/* Copy the string contents into a string inside GDB. */
str = (char *) alloca (j + 1);
read_memory (tem, str, j);
if (j != 0)
read_memory (tem, str, j);
str[j] = 0;
printf_filtered (current_substring, str);