From: tip-bot for Alan Cox <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, linux-kernel@vger.kernel.org,
alan@linux.intel.com, hpa@zytor.com, mingo@kernel.org,
peterz@infradead.org, gnomes@lxorguk.ukuu.org.uk,
tglx@linutronix.de
Subject: [tip:perf/urgent] perf tools: Ensure sscanf does not overrun the "mem" field
Date: Thu, 23 Jan 2014 09:04:08 -0800 [thread overview]
Message-ID: <tip-g2uoiwbrpiimb63rx32qv8ne@git.kernel.org> (raw)
Commit-ID: a761a2d8a7175b7b4e8525e0672e1a8d3c051001
Gitweb: http://git.kernel.org/tip/a761a2d8a7175b7b4e8525e0672e1a8d3c051001
Author: Alan Cox <alan@linux.intel.com>
AuthorDate: Mon, 20 Jan 2014 19:10:11 +0100
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 20 Jan 2014 16:19:08 -0300
perf tools: Ensure sscanf does not overrun the "mem" field
Make the parsing robust.
(perf has some other assumptions that BUFSIZE <= MAX_PATH which are
not touched here)
Reported-by: Jackie Chang
Signed-off-by: Alan Cox <alan@linux.intel.com>
Cc: Alan Cox <gnomes@lxorguk.ukuu.org.uk>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/n/tip-g2uoiwbrpiimb63rx32qv8ne@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
| 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--git a/tools/perf/util/header.c b/tools/perf/util/header.c
index bb3e0ed..893f8e2 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -930,7 +930,7 @@ static int write_topo_node(int fd, int node)
/* skip over invalid lines */
if (!strchr(buf, ':'))
continue;
- if (sscanf(buf, "%*s %*d %s %"PRIu64, field, &mem) != 2)
+ if (sscanf(buf, "%*s %*d %31s %"PRIu64, field, &mem) != 2)
goto done;
if (!strcmp(field, "MemTotal:"))
mem_total = mem;
reply other threads:[~2014-01-23 17:04 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=tip-g2uoiwbrpiimb63rx32qv8ne@git.kernel.org \
--to=tipbot@zytor.com \
--cc=acme@redhat.com \
--cc=alan@linux.intel.com \
--cc=gnomes@lxorguk.ukuu.org.uk \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.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