diff options
author | Michael Snyder <msnyder@vmware.com> | 2011-03-01 20:57:52 +0000 |
---|---|---|
committer | Michael Snyder <msnyder@vmware.com> | 2011-03-01 20:57:52 +0000 |
commit | 5f01dbc03c203f4a45b48125c6ddd8700be7d8e0 (patch) | |
tree | fae90b90032485d9f09e865bdbe58e635518c775 | |
parent | d684ab85a385dc954fe05f3dc3de69069df31d7b (diff) | |
download | gdb-5f01dbc03c203f4a45b48125c6ddd8700be7d8e0.zip gdb-5f01dbc03c203f4a45b48125c6ddd8700be7d8e0.tar.gz gdb-5f01dbc03c203f4a45b48125c6ddd8700be7d8e0.tar.bz2 |
2011-03-01 Michael Snyder <msnyder@vmware.com>
* linespec.c (decode_line_1): Check for null before dereference.
-rw-r--r-- | gdb/ChangeLog | 2 | ||||
-rw-r--r-- | gdb/linespec.c | 15 |
2 files changed, 11 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e380be2..24be64c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,7 @@ 2011-03-01 Michael Snyder <msnyder@vmware.com> + * linespec.c (decode_line_1): Check for null before dereference. + * reverse.c (record_restore): Move null-check to before pointer dereference. diff --git a/gdb/linespec.c b/gdb/linespec.c index 9183064..e9548e8 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -726,7 +726,7 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab, char *copy; /* This says whether or not something in *ARGPTR is quoted with completer_quotes (i.e. with single quotes). */ - int is_quoted; + int is_quoted = 0; /* Is *ARGPTR is enclosed in double quotes? */ int is_quote_enclosed; int is_objc_method = 0; @@ -745,12 +745,15 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab, /* See if arg is *PC. */ - if (**argptr == '*') - return decode_indirect (argptr); + if (*argptr) + { + if (**argptr == '*') + return decode_indirect (argptr); + + is_quoted = (strchr (get_gdb_completer_quote_characters (), + **argptr) != NULL); + } - is_quoted = (*argptr - && strchr (get_gdb_completer_quote_characters (), - **argptr) != NULL); if (is_quoted) end_quote = skip_quoted (*argptr); |