[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAP-5=fULG7CbwB0vOBkStsRV5j7=XX_F0x+fzK7KHyqp-9Y0_g@mail.gmail.com>
Date: Thu, 3 Sep 2020 10:47:39 -0700
From: Ian Rogers <irogers@...gle.com>
To: Namhyung Kim <namhyung@...nel.org>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
Jiri Olsa <jolsa@...hat.com>, Ingo Molnar <mingo@...nel.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Stephane Eranian <eranian@...gle.com>,
LKML <linux-kernel@...r.kernel.org>,
Andi Kleen <andi@...stfloor.org>,
John Garry <john.garry@...wei.com>,
Kajol Jain <kjain@...ux.ibm.com>
Subject: Re: [PATCH] perf jevents: Fix suspicious code in fixregex()
On Thu, Sep 3, 2020 at 8:25 AM Namhyung Kim <namhyung@...nel.org> wrote:
>
> The new string should have enough space for the original string and
> the back slashes IMHO.
>
> Cc: John Garry <john.garry@...wei.com>
> Cc: Kajol Jain <kjain@...ux.ibm.com>
> Cc: Ian Rogers <irogers@...gle.com>
> Signed-off-by: Namhyung Kim <namhyung@...nel.org>
Reviewed-by: Ian Rogers <irogers@...gle.com>
Definitely looks like the right fix. I'm surprised this hasn't shown
up in sanitizer testing.
Thanks,
Ian
> ---
> tools/perf/pmu-events/jevents.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c
> index fa86c5f997cc..fc9c158bfa13 100644
> --- a/tools/perf/pmu-events/jevents.c
> +++ b/tools/perf/pmu-events/jevents.c
> @@ -137,7 +137,7 @@ static char *fixregex(char *s)
> return s;
>
> /* allocate space for a new string */
> - fixed = (char *) malloc(len + 1);
> + fixed = (char *) malloc(len + esc_count + 1);
> if (!fixed)
> return NULL;
>
> --
> 2.28.0.402.g5ffc5be6b7-goog
>
Powered by blists - more mailing lists