From: Pedro Alves <pedro@palves.net>
To: Simon Marchi <simon.marchi@polymtl.ca>, gdb-patches@sourceware.org
Cc: Jan Vrany <jan.vrany@labware.com>
Subject: Re: [PATCH RESEND] gdb: remove static buffer in command_line_input
Date: Fri, 16 Dec 2022 13:21:21 +0000 [thread overview]
Message-ID: <1e61d9cc-00e0-56d6-c232-96d465a78782@palves.net> (raw)
In-Reply-To: <20221215190625.758546-1-simon.marchi@polymtl.ca>
On 2022-12-15 7:06 p.m., Simon Marchi via Gdb-patches wrote:
> else
> {
> /* Copy whole line including terminating null, and we're
> done. */
> - buffer_grow (cmd_line_buffer, rl, len + 1);
> - cmd = cmd_line_buffer->buffer;
> + cmd_line_buffer.append (rl, len + 1);
> + return true;
std::string is guaranteed to be null terminated, but, it can also hold
\0 characters in the middle of the string. Isn't that
cmd_line_buffer.append (rl, len + 1);
ending up with an embedded \0 at the end of the string, with cmd_line_buffer.size() accounting for it?
> }
next prev parent reply other threads:[~2022-12-16 13:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-15 19:06 Simon Marchi
2022-12-15 21:44 ` Tom Tromey
2022-12-16 2:49 ` Simon Marchi
2022-12-16 13:21 ` Pedro Alves [this message]
2022-12-16 13:38 ` Simon Marchi
2022-12-16 14:11 ` 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=1e61d9cc-00e0-56d6-c232-96d465a78782@palves.net \
--to=pedro@palves.net \
--cc=gdb-patches@sourceware.org \
--cc=jan.vrany@labware.com \
--cc=simon.marchi@polymtl.ca \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).