From: Michael Snyder <msnyder@vmware.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: [commit] linespec.c, decode_line_1, check for null.
Date: Tue, 01 Mar 2011 20:57:00 -0000 [thread overview]
Message-ID: <4D6D5DBA.90604@vmware.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 98 bytes --]
If it's worth checking for null, it's worth doing so before the first
dereference.
Checked in.
[-- Attachment #2: reversenull4.txt --]
[-- Type: text/plain, Size: 1254 bytes --]
2011-03-01 Michael Snyder <msnyder@vmware.com>
* linespec.c (decode_line_1): Check for null before dereference.
Index: linespec.c
===================================================================
RCS file: /cvs/src/src/gdb/linespec.c,v
retrieving revision 1.110
diff -u -p -u -p -r1.110 linespec.c
--- linespec.c 1 Mar 2011 00:26:14 -0000 1.110
+++ linespec.c 1 Mar 2011 20:53:54 -0000
@@ -726,7 +726,7 @@ decode_line_1 (char **argptr, int funfir
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 funfir
/* 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);
next reply other threads:[~2011-03-01 20:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-01 20:57 Michael Snyder [this message]
2011-03-01 21:25 ` Pedro Alves
2011-03-01 21:43 ` Michael Snyder
2011-03-01 21:50 ` Pedro Alves
2011-03-01 22:03 ` Michael Snyder
2011-03-01 22:08 ` 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=4D6D5DBA.90604@vmware.com \
--to=msnyder@vmware.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