From: Pedro Alves <palves@redhat.com>
To: gdb-patches@sourceware.org, dcb314@hotmail.com
Subject: Re: [PATCH][PR gdb/16013] Fix off-by-one errors in *scanf format strings
Date: Mon, 14 Oct 2013 11:25:00 -0000 [thread overview]
Message-ID: <525BD49B.4080700@redhat.com> (raw)
In-Reply-To: <20131014105252.GA5262@blade.nx>
On 10/14/2013 11:52 AM, Gary Benson wrote:
> Hi all,
>
> This patch fixes a number of off-by-one errors in *scanf format
> strings.
These could be fixed by either reducing the length specified
in the format string, or, by increasing the buffers. Either
such change would be obvious from a coding perspective. But
the part that requires a rationale, is, that one that justifies
the taken approach. That will be governed what the actual lengths
of these fields on the kernel side. E.g.:
/* sizeof (cmd) should be greater or equal to TASK_COMM_LEN (in
include/linux/sched.h in the Linux kernel sources) plus two
(for the brackets). */
char cmd[32];
PID_T stat_pid;
int items_read = fscanf (fp, "%lld %32s", &stat_pid, cmd);
Did you check the value of TASK_COMM_LEN ? (I haven't).
Same for the other fields.
--
Pedro Alves
next prev parent reply other threads:[~2013-10-14 11:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-14 10:52 Gary Benson
2013-10-14 11:25 ` Pedro Alves [this message]
2013-10-18 14:39 ` [PATCH v2][PR " Gary Benson
2013-10-18 16:38 ` 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=525BD49B.4080700@redhat.com \
--to=palves@redhat.com \
--cc=dcb314@hotmail.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).