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]

Segfault on empty 'strace'


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


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