From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08852C38147 for ; Wed, 18 Jan 2023 14:03:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230499AbjARODO (ORCPT ); Wed, 18 Jan 2023 09:03:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229872AbjAROC4 (ORCPT ); Wed, 18 Jan 2023 09:02:56 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8332953F9A; Wed, 18 Jan 2023 05:37:16 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0FDCC617D4; Wed, 18 Jan 2023 13:37:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A6C1C433D2; Wed, 18 Jan 2023 13:37:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674049035; bh=0xJGKj3eRqUoWBwB+TjH6T+WceRDQEQkTnoUc5UVybU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=JJE4rrtphL6e9IS0xXRTIi59Nl06Yzx++7lIR0xkpflGRDTvhL5qpX1KhZaufA6/e PWP2ddV4Otbx3auIz1juBpjuGyN4Lfjq4dU23T0R3rgLIvDidvpQviKjxQQJiLm7RH 1W6m4T22I/hRnJA95HUDZWXHfH/nSi0WmZXbBK0Ib5Z5mp4bnh/qGAy7SAfW1rievj ZflxyWBYcH+PAfay5lwQPcWpSE+aMWiIbnDVz9NrJaej1Kasp21ElOz0tTOQv5+rZ2 mNvdxWF13kzf+54tGC1KfaJG0NNafipHU3isqHfeWtZJXuizeN/y6ndWVgTNPuGgCg OS0haJ8FVyzUg== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id BBAB7405BE; Wed, 18 Jan 2023 10:37:12 -0300 (-03) Date: Wed, 18 Jan 2023 10:37:12 -0300 From: Arnaldo Carvalho de Melo To: Ian Rogers Cc: Jiri Olsa , Sohom Datta , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Namhyung Kim , Sohom Datta , linux-perf-users , LKML Subject: Re: [PATCH] Prevent normalize() from reading into undefined memory Message-ID: References: <20221204105836.1012885-1-sohomdatta1+git@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Url: http://acmel.wordpress.com Precedence: bulk List-ID: X-Mailing-List: linux-perf-users@vger.kernel.org Em Sun, Jan 08, 2023 at 04:55:59PM -0800, Ian Rogers escreveu: > On Sun, Jan 8, 2023, 6:13 AM Jiri Olsa wrote: > > > On Sun, Dec 04, 2022 at 04:28:35PM +0530, Sohom Datta wrote: > > > The current implementation does not account for a > > > trailing backslash followed by a null-byte. If a > > > null-byte is encountered following a backslash, > > > normalize() will continue reading (and potentially > > > writing) into garbage memory ignoring the EOS > > > null-byte. > > > > > > Signed-off-by: Sohom Datta > > > > Acked-by: Jiri Olsa > > > > thanks, > > jirka > > > > Acked-by: Ian Rogers Thanks, applied. Sorry for the delay, probably I didn't saw the "perf tools: ' prefix in the subject and this fell thru the cracks :-\ Thanks to Ingo for pinging me about this, appreciated. - Arnaldo > Thanks, > Ian > > > --- > > > tools/perf/util/expr.l | 5 ++++- > > > 1 file changed, 4 insertions(+), 1 deletion(-) > > > > > > diff --git a/tools/perf/util/expr.l b/tools/perf/util/expr.l > > > index 0168a9637330..d47de5f270a8 100644 > > > --- a/tools/perf/util/expr.l > > > +++ b/tools/perf/util/expr.l > > > @@ -42,8 +42,11 @@ static char *normalize(char *str, int runtime) > > > char *dst = str; > > > > > > while (*str) { > > > - if (*str == '\\') > > > + if (*str == '\\') { > > > *dst++ = *++str; > > > + if (!*str) > > > + break; > > > + } > > > else if (*str == '?') { > > > char *paramval; > > > int i = 0; > > > -- > > > 2.38.1 > > > > >