This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH]: minor fix to printf_command


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]