Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp174283ybt; Tue, 23 Jun 2020 18:38:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhcLSjgY5m5sXZq8BoUXM3Wy/Rv0NdmBPoPGIuch7OBzop9LG7WeezciN2dMvA0o8LVeM5 X-Received: by 2002:a17:906:2c18:: with SMTP id e24mr9510443ejh.335.1592962726791; Tue, 23 Jun 2020 18:38:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592962726; cv=none; d=google.com; s=arc-20160816; b=eXK3SwMCZyG7EzHD4KWeCA48vkl0oiOmnMEMI5H2Zt4cjdjjNObeOtoK+6EAihHhr+ QZMVxfSzS+iEl28/H+r7jbq6hSCOsaaIRUUFpzMCu/PfYHu+snsGtETKkRHFO5HkZbLJ /kF801nhssWfR1pU/db75yQhABJiE+KKduix6g33u/zl5NHBTnkfVT93hcMdIRSr12rY FqRqAO8KDdA4YIGBNOaD5UJRd4YFOnSom/XGPYdk7wujuU8HcV6Sv6OhNb56iNdBneMO F1Tz3EAEe5PkwMBAddpgI7EFuAyBv1sf3636Q8iyeQ7MaZrMq3HFtKp+rO0R3YPoaaxj IIBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:to:from :dkim-signature; bh=TqReVHnhod4CGtUTTe7lNXyrQSlqJcDme46q9bN7OuI=; b=OjCNFwI6lpbpceFi4CRcyJwQ0TZPdMMu7gtk1cemQhe/2vz9OC/1fbcWzAk2DJNAL1 NSJAg8oq7xQCfMDIpS12MyCQ3IKMm6Yj6X1SxHleEMS0uj0sLQRLO9eamjx09eFkDDHJ rKoSd9KoOycSfrQuoPuUlDXHaD1cNu7v2meA7rTNVn1/hAsnYrfMDKmdHzNYQNO9IQkG wFV/uDH2Q962nnWfB1GLR8qpBdc56bI2Qm93BgXwyOOeXQdVvirboUAe4CoKvo+VtCUX xwn+dy0Qs6AORHYwaQDM/mpdh8AmzLDGpTY/a4ogcJkno+TuVVoqM7QltD2MT0/1pcSq 2U0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="d/oz4MDQ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l15si6975841ejq.119.2020.06.23.18.38.23; Tue, 23 Jun 2020 18:38:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="d/oz4MDQ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388466AbgFXBfh (ORCPT + 99 others); Tue, 23 Jun 2020 21:35:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387804AbgFXBfe (ORCPT ); Tue, 23 Jun 2020 21:35:34 -0400 Received: from mail-qv1-xf44.google.com (mail-qv1-xf44.google.com [IPv6:2607:f8b0:4864:20::f44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07504C061573 for ; Tue, 23 Jun 2020 18:35:33 -0700 (PDT) Received: by mail-qv1-xf44.google.com with SMTP id dm12so339432qvb.9 for ; Tue, 23 Jun 2020 18:35:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=TqReVHnhod4CGtUTTe7lNXyrQSlqJcDme46q9bN7OuI=; b=d/oz4MDQJGr5mV4CIQqGnXLaXd79fCAfN+CrAt3YjNYFXWnK1lPtNAlqGzC+T+WYqw TXe2Ccq6IlgN0g7IpMVH2H1ewkzPKdwJC+GUShrl+t4PsZTAmL+zYAb213Kilihp97fv RBEM5pZeyrjUyg0XpRAPLDI8g7wRMyr4GQGNsqq36S9kvzuZ3/A07/mJXD9rHWmahc9R rk1F4xazJf5+t/+JWj/emeu23tgXCBDUUDY87uuo2ert2gjlV7wn18YckP2WqNbAcJOH 5pGmF3WR6PmZQDBsAOJS4rmai41CkqS7PaQfE+eqwEa37Lh5XJ/D6G4UcAtEPsGMeifW 4OXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=TqReVHnhod4CGtUTTe7lNXyrQSlqJcDme46q9bN7OuI=; b=j5hp/tw9ty3nBTSqNAnUhBRo4J20c3sSnGYN75qJNaI1E0gt/pn67sA64F2/ZyNLFO xErCPKx7A6/vk2Ox6qEKnWi0AhxYsAMtWhzpz8ghJWO63h5nsoFKtE1RUUDHbUtT3+U3 fmRsmPsT9Po0DT/FvlzgIxXQE7Zln5EtP1xFlumtDDI7GQJshEvl+8r9eZUO28ONXo8q JC39rB9jX4klAurgQY7It+u8EyDhWJUmtPuPUk6RFryAezW55F9WFKcsjgSSXhzc5ZOR vttxy9Nk9sVCMgYfhbmu8lHi898scK0o1vF/MjJ1+C2G4hLj+ttm0UKDVcqKW8BCpZm2 /vEw== X-Gm-Message-State: AOAM530FLxPO3NICJ6Nke+gIPAtmqfJQXu6fMSKTugJddL7ChaiPCVxF z82jIpXIhhMHJaQq72n4oJk= X-Received: by 2002:a0c:a993:: with SMTP id a19mr4030626qvb.34.1592962532275; Tue, 23 Jun 2020 18:35:32 -0700 (PDT) Received: from linux.home ([2604:2000:1344:41d:596e:7d49:a74:946e]) by smtp.googlemail.com with ESMTPSA id h4sm2102136qtd.43.2020.06.23.18.35.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jun 2020 18:35:31 -0700 (PDT) From: Gaurav Singh To: gaurav1086@gmail.com, Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , 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 Message-Id: <20200624013524.10836-1-gaurav1086@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Check bounds before accessing d->d_name[]. Signed-off-by: Gaurav Singh --- 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