Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Marc Khouzam <marc.khouzam@ericsson.com>
To: "'gdb-patches@sourceware.org'" <gdb-patches@sourceware.org>
Subject: Segfault on empty 'strace'
Date: Thu, 25 Nov 2010 21:22:00 -0000	[thread overview]
Message-ID: <F7CE05678329534C957159168FA70DEC572E79BC9E@EUSAACMS0703.eamcs.ericsson.se> (raw)

Hi,

segfault on an empty 'strace' command.
The patch below checks for NULL before calling strncmp().

> ./gdb -ex strace
GNU gdb (GDB) 7.2.50.20101125-cvs
Segmentation fault

No regressions.

Ok?
What about 7_2?

Thanks

Marc

2010-11-25  Marc Khouzam  <marc.khouzam@ericsson.com>

	* breakpoint.c (is_marker_spec): Check for NULL.

### Eclipse Workspace Patch 1.0
#P src
Index: gdb/breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.516
diff -u -r1.516 breakpoint.c
--- gdb/breakpoint.c    11 Nov 2010 14:11:51 -0000      1.516
+++ gdb/breakpoint.c    25 Nov 2010 21:09:56 -0000
@@ -222,7 +222,7 @@
 /* Assuming we're creating a static tracepoint, does S look like a
    static tracepoint marker spec ("-m MARKER_ID")?  */
 #define is_marker_spec(s)                                              \
-  (strncmp (s, "-m", 2) == 0 && ((s)[2] == ' ' || (s)[2] == '\t'))
+  (s != NULL && strncmp (s, "-m", 2) == 0 && ((s)[2] == ' ' || (s)[2] == '\t'))
 
 /* A reference-counted struct command_line.  This lets multiple
    breakpoints share a single command list.  */


             reply	other threads:[~2010-11-25 21:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-25 21:22 Marc Khouzam [this message]
2010-11-25 21:47 ` Pedro Alves
2010-11-25 23:28   ` Marc Khouzam
2010-11-25 23:35     ` Pedro Alves

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=F7CE05678329534C957159168FA70DEC572E79BC9E@EUSAACMS0703.eamcs.ericsson.se \
    --to=marc.khouzam@ericsson.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