This is the mail archive of the gdb-patches@sourceware.org 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]
Other format: [Raw text]

Re: [PATCH] Fix PR gdb/15678 Typing "enable count" crashes gdb


On 08/07/2013 02:00 PM, Muhammad Waqas wrote:
Patch for http://sourceware.org/bugzilla/show_bug.cgi?id=15678

gdb crashes when "enable count" command is entered.

In function enable_count_command no checks for args if it's null
or not and pass it to get_number function where gdb crashed
while doing dereference to null pointer.
So I added code to check if args is null then put
error to user Arguments are need.

Changlog

2013-08-07  Muhammad Waqas  <mwaqas@codesourcery.com>

    PR gdb/15678
    * breakpoint.c (enable_count_command): Fix gdb crash if args
    is null.

Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.773
diff -u -p -r1.773 breakpoint.c
--- breakpoint.c    24 Jul 2013 19:50:32 -0000    1.773
+++ breakpoint.c    7 Aug 2013 08:46:02 -0000
@@ -14740,9 +14740,16 @@ do_map_enable_count_breakpoint (struct b
 static void
 enable_count_command (char *args, int from_tty)
 {
-  int count = get_number (&args);
-
-  map_breakpoint_numbers (args, do_map_enable_count_breakpoint, &count);
+  if (args == NULL)
+    {
+      error_no_arg (_("count, breakpoints"));
+    }
+  else
+    {
+      int count = get_number (&args);
+
+ map_breakpoint_numbers (args, do_map_enable_count_breakpoint, &count);
+    }
 }

 static void

Sorry every one I with draw this patch I didn't noticed it is already fixed.


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