perf: Read buffer overflow
PATCH 1/1 perf: Read buffer overflow
Check whether index is within bounds before testing the element.
Signed-off-by Roel Kluin <[email protected]>
---
tools/perf/builtin-report.c +1 -1
@@ -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;
tools/perf/util/quote.c +1 -1
@@ -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 ;
Ingo Molnar
AppliedQuoted 3 lines · Roel Kluin
Check whether index is within bounds before testing the element.
Signed-off-by Roel Kluin <[email protected]>
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
[tip:perfcounters/urgent] perf: Fix read buffer overflow
In reply to Roel KluinCommit-ID: 7e030655dda5b5efc4305e2a8f46c4967d32eb3d Gitweb: http://git.kernel.org/tip/7e030655dda5b5efc4305e2a8f46c4967d32eb3d Author: Roel Kluin <[email protected]> AuthorDate: Sun, 2 Aug 2009 13:43:11 +0200 Committer: Ingo Molnar <[email protected]> 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 <[email protected]>
Cc Andrew Morton <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by Ingo Molnar <[email protected]>
--- tools/perf/builtin-report.c | 2 +- tools/perf/util/quote.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
tools/perf/builtin-report.c +1 -1
@@ -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;
tools/perf/util/quote.c +1 -1
@@ -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 ;