Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Andrew Burgess <aburgess@redhat.com>
Cc: Tom de Vries <tdevries@suse.de>,  gdb-patches@sourceware.org
Subject: Re: [PATCH] [gdb] Fix heap-buffer-overflow in args_complete_p
Date: Mon, 05 Jan 2026 13:09:40 -0700	[thread overview]
Message-ID: <874iozvn23.fsf@tromey.com> (raw)
In-Reply-To: <874iozygr7.fsf@redhat.com> (Andrew Burgess's message of "Mon, 05 Jan 2026 19:57:32 +0000")

>>>>> "Andrew" == Andrew Burgess <aburgess@redhat.com> writes:

Andrew> Sorry to be a bore, but after reading this commit, and the bug report,
Andrew> it's still not obvious to me where the overflow actually occurs.

I believe in this code:

	  if (*input == '\\' && strchr ("\"\\'", *(input + 1)) != nullptr)
	    ++input;

if *input == '\\' but this is also the last character of the string,
then strchr will return the address of the \0, then ++input will advance
past it.

I think sticking "&& input[1] != '\0'" in there might be sufficient.

Though perhaps there's also an issue if the string ends with spaces,
because:

      input = skip_spaces (input);
...
      ++input;

Tom

  parent reply	other threads:[~2026-01-05 20:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-03 14:55 Tom de Vries
2026-01-05 16:38 ` Tom Tromey
2026-01-06 14:51   ` Tom de Vries
2026-01-05 19:57 ` Andrew Burgess
2026-01-05 20:02   ` Andrew Burgess
2026-01-05 20:09   ` Tom Tromey [this message]
2026-01-06  8:47   ` Tom de Vries
2026-01-06  9:29     ` Tom de Vries
2026-01-06 14:53     ` Tom de Vries
2026-01-07 10:46     ` Andrew Burgess
2026-01-07 11:21       ` Tom de Vries
2026-01-07 15:01         ` Andrew Burgess
2026-01-07 18:13           ` Tom Tromey
2026-01-12 11:42             ` Andrew Burgess

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=874iozvn23.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tdevries@suse.de \
    /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