From: Gaurav Singh <gaurav1086@gmail.com>
To: gaurav1086@gmail.com, Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
linux-kernel@vger.kernel.org (open list:PERFORMANCE EVENTS
SUBSYSTEM)
Subject: [PATCH] [perf] lsdir_bid_tail_filter: fix index check
Date: Tue, 23 Jun 2020 21:35:22 -0400 [thread overview]
Message-ID: <20200624013524.10836-1-gaurav1086@gmail.com> (raw)
Check bounds before accessing d->d_name[].
Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
---
tools/perf/util/build-id.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c
index c076fc7fe025..8c35cbe93f10 100644
--- a/tools/perf/util/build-id.c
+++ b/tools/perf/util/build-id.c
@@ -431,7 +431,7 @@ static bool lsdir_bid_tail_filter(const char *name __maybe_unused,
struct dirent *d)
{
int i = 0;
- while (isxdigit(d->d_name[i]) && i < SBUILD_ID_SIZE - 3)
+ while (i < SBUILD_ID_SIZE - 3 && isxdigit(d->d_name[i]))
i++;
return (i == SBUILD_ID_SIZE - 3) && (d->d_name[i] == '\0');
}
--
2.17.1
next reply other threads:[~2020-06-24 1:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-24 1:35 Gaurav Singh [this message]
2020-06-24 12:50 ` Jiri Olsa
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=20200624013524.10836-1-gaurav1086@gmail.com \
--to=gaurav1086@gmail.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.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
all inboxes | Powered by JetHome®