* [PATCH] perf: Read buffer overflow
@ 2009-08-02 11:43 Roel Kluin
2009-08-04 9:11 ` Ingo Molnar
2009-08-04 11:37 ` [tip:perfcounters/urgent] perf: Fix read " tip-bot for Roel Kluin
0 siblings, 2 replies; 3+ messages in thread
From: Roel Kluin @ 2009-08-02 11:43 UTC (permalink / raw)
To: a.p.zijlstra, Andrew Morton, LKML
Check whether index is within bounds before testing the element.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index b20a4b6..edecdbe 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -252,7 +252,7 @@ static int strcommon(const char *pathname)
{
int n = 0;
- while (pathname[n] == cwd[n] && n < cwdlen)
+ while (n < cwdlen && pathname[n] == cwd[n])
++n;
return n;
diff --git a/tools/perf/util/quote.c b/tools/perf/util/quote.c
index c6e5dc0..2726fe4 100644
--- a/tools/perf/util/quote.c
+++ b/tools/perf/util/quote.c
@@ -318,7 +318,7 @@ char *quote_path_relative(const char *in, int len,
strbuf_addch(out, '"');
if (prefix) {
int off = 0;
- while (prefix[off] && off < len && prefix[off] == in[off])
+ while (off < len && prefix[off] && prefix[off] == in[off])
if (prefix[off] == '/') {
prefix += off + 1;
in += off + 1;
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] perf: Read buffer overflow
2009-08-02 11:43 [PATCH] perf: Read buffer overflow Roel Kluin
@ 2009-08-04 9:11 ` Ingo Molnar
2009-08-04 11:37 ` [tip:perfcounters/urgent] perf: Fix read " tip-bot for Roel Kluin
1 sibling, 0 replies; 3+ messages in thread
From: Ingo Molnar @ 2009-08-04 9:11 UTC (permalink / raw)
To: Roel Kluin; +Cc: a.p.zijlstra, Andrew Morton, LKML
* Roel Kluin <roel.kluin@gmail.com> wrote:
> Check whether index is within bounds before testing the element.
>
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Applied, thanks Roel.
A small request for future patches: please always put a verb into
Linux kernel patch titles. I.e. instead of:
perf: Read buffer overflow
use something like:
perf: Fix read buffer overflow
this holds for all the other patches you sent to lkml as well.
Thanks,
Ingo
^ permalink raw reply [flat|nested] 3+ messages in thread
* [tip:perfcounters/urgent] perf: Fix read buffer overflow
2009-08-02 11:43 [PATCH] perf: Read buffer overflow Roel Kluin
2009-08-04 9:11 ` Ingo Molnar
@ 2009-08-04 11:37 ` tip-bot for Roel Kluin
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Roel Kluin @ 2009-08-04 11:37 UTC (permalink / raw)
To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, akpm, roel.kluin, tglx, mingo
Commit-ID: 7e030655dda5b5efc4305e2a8f46c4967d32eb3d
Gitweb: http://git.kernel.org/tip/7e030655dda5b5efc4305e2a8f46c4967d32eb3d
Author: Roel Kluin <roel.kluin@gmail.com>
AuthorDate: Sun, 2 Aug 2009 13:43:11 +0200
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 4 Aug 2009 11:09:56 +0200
perf: Fix read buffer overflow
Check whether index is within bounds before testing the element.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Cc: a.p.zijlstra@chello.nl
Cc: Andrew Morton <akpm@linux-foundation.org>
LKML-Reference: <4A757BCF.40101@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
tools/perf/builtin-report.c | 2 +-
tools/perf/util/quote.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 95fd06c..ce4f286 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -253,7 +253,7 @@ static int strcommon(const char *pathname)
{
int n = 0;
- while (pathname[n] == cwd[n] && n < cwdlen)
+ while (n < cwdlen && pathname[n] == cwd[n])
++n;
return n;
diff --git a/tools/perf/util/quote.c b/tools/perf/util/quote.c
index c6e5dc0..2726fe4 100644
--- a/tools/perf/util/quote.c
+++ b/tools/perf/util/quote.c
@@ -318,7 +318,7 @@ char *quote_path_relative(const char *in, int len,
strbuf_addch(out, '"');
if (prefix) {
int off = 0;
- while (prefix[off] && off < len && prefix[off] == in[off])
+ while (off < len && prefix[off] && prefix[off] == in[off])
if (prefix[off] == '/') {
prefix += off + 1;
in += off + 1;
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-08-04 11:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-02 11:43 [PATCH] perf: Read buffer overflow Roel Kluin
2009-08-04 9:11 ` Ingo Molnar
2009-08-04 11:37 ` [tip:perfcounters/urgent] perf: Fix read " tip-bot for Roel Kluin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox