From: Tom Tromey <tom@tromey.com>
To: Andrew Burgess <aburgess@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 3/3] gdb/remote: improve error checking for 'p' packet reply
Date: Mon, 09 Nov 2026 10:27:49 -0700 [thread overview]
Message-ID: <875wy5vrsa.fsf@tromey.com> (raw)
In-Reply-To: <74dfd6c36ec51bc513bc84ec5480d8c3421ca3a4.1794238395.git.aburgess@redhat.com> (Andrew Burgess's message of "Mon, 9 Nov 2026 15:35:52 +0000")
>>>>> "Andrew" == Andrew Burgess <aburgess@redhat.com> writes:
Andrew> When building the outgoing packet use xsnprintf; this allows for
Andrew> bounds checking as the packet is being written. The chances of the
Andrew> outgoing packet overflowing are pretty slim, but using a bounded write
Andrew> seems better than not, so let's do that.
I suppose for this to assert we'd have to have a packet that's smaller
than a register number and the register value. But I guess we
anticipate that this can't really happen? Or is pathological enough
that we don't care?
Andrew> + /* Otherwise, parse the register value from the hex string. */
Andrew> + struct gdbarch *gdbarch = regcache->arch ();
Andrew> + int reg_size = register_size (gdbarch, reg->regnum);
Andrew> + gdb_byte *regp = (gdb_byte *) alloca (reg_size);
I would prefer it if we didn't add new calls to alloca to the tree.
I think alloca is bad and that generally we will not notice an extra
allocation.
Tom
next prev parent reply other threads:[~2026-11-09 17:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-09 15:35 [PATCH 0/3] gdb/remote: improve packet buffer checks for p packet Andrew Burgess
2026-11-09 15:35 ` [PATCH 1/3] gdbsupport: update comment on hex2bin Andrew Burgess
2026-11-09 16:49 ` Tom Tromey
2026-11-09 15:35 ` [PATCH 2/3] gdbserver: add support for p/P packets and flag to disable g/G packets Andrew Burgess
2026-11-09 17:16 ` Tom Tromey
2026-11-09 15:35 ` [PATCH 3/3] gdb/remote: improve error checking for 'p' packet reply Andrew Burgess
2026-11-09 17:27 ` Tom Tromey [this message]
2026-11-23 16:44 ` 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=875wy5vrsa.fsf@tromey.com \
--to=tom@tromey.com \
--cc=aburgess@redhat.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