Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Segfault on empty 'strace'
@ 2010-11-25 21:22 Marc Khouzam
  2010-11-25 21:47 ` Pedro Alves
  0 siblings, 1 reply; 4+ messages in thread
From: Marc Khouzam @ 2010-11-25 21:22 UTC (permalink / raw)
  To: 'gdb-patches@sourceware.org'

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.  */


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-11-25 23:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-25 21:22 Segfault on empty 'strace' Marc Khouzam
2010-11-25 21:47 ` Pedro Alves
2010-11-25 23:28   ` Marc Khouzam
2010-11-25 23:35     ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox