From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3766 invoked by alias); 7 Aug 2013 09:01:34 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 3695 invoked by uid 89); 7 Aug 2013 09:01:31 -0000 X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.3.1 Received: from Unknown (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 07 Aug 2013 09:01:00 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1V6zbw-0000OZ-VO from Muhammad_Waqas@mentor.com for gdb-patches@sourceware.org; Wed, 07 Aug 2013 02:00:52 -0700 Received: from SVR-ORW-FEM-04.mgc.mentorg.com ([147.34.97.41]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 7 Aug 2013 02:00:52 -0700 Received: from [137.202.157.111] (147.34.91.1) by SVR-ORW-FEM-04.mgc.mentorg.com (147.34.97.41) with Microsoft SMTP Server (TLS) id 14.2.247.3; Wed, 7 Aug 2013 02:00:51 -0700 Message-ID: <52020CBB.10502@codesourcery.com> Date: Wed, 07 Aug 2013 09:01:00 -0000 From: Muhammad Waqas User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130623 Thunderbird/17.0.7 MIME-Version: 1.0 To: Subject: [PATCH] Fix PR gdb/15678 Typing "enable count" crashes gdb Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2013-08/txt/msg00183.txt.bz2 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 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