This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH]: minor fix to printf_command
- To: gdb-patches at sourceware dot cygnus dot com
- Subject: [PATCH]: minor fix to printf_command
- From: Michael Snyder <msnyder at cygnus dot com>
- Date: Fri, 21 Jul 2000 17:08:40 -0700
- Newsgroups: cygnus.patches.gdb
- Organization: Cygnus Solutions
2000-07-21 Michael Snyder <msnyder@cleaver.cygnus.com>
* printcmd.c (printf_command): Guard against 0-length string.
diff -p -r1.10 printcmd.c
*** printcmd.c 2000/07/11 08:51:59 1.10
--- printcmd.c 2000/07/22 00:07:50
*************** printf_command (arg, from_tty)
*** 2331,2337 ****
/* Copy the string contents into a string inside GDB. */
str = (char *) alloca (j + 1);
! read_memory (tem, str, j);
str[j] = 0;
printf_filtered (current_substring, str);
--- 2331,2338 ----
/* Copy the string contents into a string inside GDB. */
str = (char *) alloca (j + 1);
! if (j != 0)
! read_memory (tem, str, j);
str[j] = 0;
printf_filtered (current_substring, str);