Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Muhammad Waqas <mwaqas@codesourcery.com>
To: <gdb-patches@sourceware.org>
Subject: [PATCH]  Fix PR  gdb/15678  Typing "enable count" crashes gdb
Date: Wed, 07 Aug 2013 09:01:00 -0000	[thread overview]
Message-ID: <52020CBB.10502@codesourcery.com> (raw)

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


             reply	other threads:[~2013-08-07  9:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-07  9:01 Muhammad Waqas [this message]
2013-08-07  9:23 ` Muhammad Waqas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52020CBB.10502@codesourcery.com \
    --to=mwaqas@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox