Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Keith Seitz <keiths@redhat.com>
To: Yao Qi <qiyaoltc@gmail.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH master/7.12] Fix heap-buffer-overflow in explicit_location_lex_one
Date: Fri, 12 Aug 2016 16:39:00 -0000	[thread overview]
Message-ID: <57ADFBD5.5060507@redhat.com> (raw)
In-Reply-To: <1471005890-24205-1-git-send-email-yao.qi@linaro.org>

On 08/12/2016 05:44 AM, Yao Qi wrote:
> the code in question is:
> 
>>         /* Special case: C++ operator,.  */
>>         if (language->la_language == language_cplus
>>             && strncmp (*inp, "operator", 8)  <--- [1]
>>             && (*inp)[9] == ',')
>>           (*inp) += 9;
>>         ++(*inp);
[snip]

Yeah, that does look odd... Normally, I would not leave the result of
strcmp et al unchecked like this since those functions do not return a
boolean value. So I'd say it must have been a bad day. A really bad day.

> Is it OK?

While your patch alters the behavior ever so slightly (originally, it
was meant to skip over "operator," -- now it skips over "operator" and
the next char), I don't think that it will impact what this code
actually does. It looks good to me.

Good catch!

Keith


  reply	other threads:[~2016-08-12 16:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-12 12:45 Yao Qi
2016-08-12 16:39 ` Keith Seitz [this message]
2016-08-15 11:34   ` Yao Qi

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=57ADFBD5.5060507@redhat.com \
    --to=keiths@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=qiyaoltc@gmail.com \
    /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