Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp151792lqo; Thu, 16 May 2024 02:04:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXgtCin/zMoTt9oCDA6dhpBbFt9+QpH40XpAwMxswTxhTzxx5UgYnBa0pXPw9hGVHJMbw1MuppPAoc/exFOYYMub1XjmiajdbrW+VPodA== X-Google-Smtp-Source: AGHT+IGEurtFbgGVDNwiTmPWl/zthb3I+p7b6ZtfdwlDYDiD5OkMWrovg4vKVQ0gaRAGvKg+hG4f X-Received: by 2002:a05:6a20:5602:b0:1af:5195:d035 with SMTP id adf61e73a8af0-1afde197929mr16119798637.45.1715850262791; Thu, 16 May 2024 02:04:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715850262; cv=pass; d=google.com; s=arc-20160816; b=N+/XnudKxvMNdcS8aaKwqHuCWWq1LvuRIgebxF223zGUl1QUHeqpJsr7QiaXq3xeM/ U542nnTJlwSKJA/O4sTY1HqnEayKUfxFA6xg/6BoZGv008NWqEIvceqGOEjiS06lEGOr jahqFzWbx2M7AMxoScwgC2Xqtc2ziOBLDG0GSX8W41w28Hq3AGUGOsouhb8E2aeKwFBM JSotDHYqDr5ROSRKkZvywUcdciAF6pNhdu4xi4e/XYhd7pZMk+3UNzYCkB7JAv/fvnzn 1bIXP9E0zgHSr4GPEzV2ZUAf+hlxK5PWkbr1MgyqY9NUs/1yyeMJsH2LU5OjW9OO3xKO nVng== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=I+xlUbCYfC69rnCaZ+av4zHJV1V0rj9bGIZsPJNyVhA=; fh=uo5u2TQK/HQlhydMwGLjBAnuDwaLxndJ/cgWTjIagS8=; b=ESbxTzZG6jt6TxqSjDuloQN2h89+MN1Fl9RtnxEOmtr7eS37uPgRIpZmVqJjXQ1rul DSBJly6uLfetcFGwdmkkXL/ndFDGe/7W+6Y/jLGwrmqpWtvsv/hAwBbU7KZd6MCbLT9E qeiAhV68XKcGMDQsJ1hOgO/GS4XCAS6yB2ivAEVND3EQS3S6nTOcaiRr34J5tK97ohGd LLoAvsDlpB54WjpYe+TjNtOIW0Tyrrn5tOQde6MoDBPzGuzyR3QJmtnb0l9gfltBsBvx EN7679VjKqwIDCoeoLyTrsmSg41xVhAvdj32jkfuzZAX4rTCJhDHOYTM5RYiSH0QyyHZ h6/w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=hadess.net); spf=pass (google.com: domain of linux-bluetooth+bounces-4694-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-4694-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d9443c01a7336-1ef0b9d12desi162555075ad.58.2024.05.16.02.04.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 02:04:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-4694-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=hadess.net); spf=pass (google.com: domain of linux-bluetooth+bounces-4694-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-4694-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 5D8F0282079 for ; Thu, 16 May 2024 09:04:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1D3FB143861; Thu, 16 May 2024 09:03:52 +0000 (UTC) X-Original-To: linux-bluetooth@vger.kernel.org Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 328A3142E8E for ; Thu, 16 May 2024 09:03:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.197 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715850231; cv=none; b=IAVUyVpnWF381rs5UpEig/LPTOFoRaiZSfbOPrS03mrkQKWFqG4FEOhu4qQtMT0HGaZoR2l963051oQlEU0ckznrBq2xtLnC6K4GBLAYJdbHW/SAFp7HyJnTEqtHVuXLTwy4onOYPgqqmlzOTp+x/r9HJaUBMGy/hR/SxMIc/mY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715850231; c=relaxed/simple; bh=+Phm/GPIQ/Kb58wh0VebLZB5wfxtrZf3uXZjO+mnDKQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mu0WH/iw0XOExKBuLbuj+ccXx8gNYMz4O4nqIX/08PQc6XUxvGB8pHL0wc4jmxNQFnpZlXlXDq1vWq9JWLGh7AkB/IQf0p6K9anvAjakrYjhtF+fPe24wOskuKdZFD2mm5PaGqSTLT9p++sS8EX98o8WVoJO/MdFfg+vEfrzdF4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hadess.net; spf=pass smtp.mailfrom=hadess.net; arc=none smtp.client-ip=217.70.183.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hadess.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hadess.net Received: by mail.gandi.net (Postfix) with ESMTPSA id A2FA91C0019; Thu, 16 May 2024 09:03:43 +0000 (UTC) From: Bastien Nocera To: linux-bluetooth@vger.kernel.org Cc: Bastien Nocera Subject: [BlueZ 09/15] isotest: Fix bad free Date: Thu, 16 May 2024 11:03:13 +0200 Message-ID: <20240516090340.61417-10-hadess@hadess.net> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240516090340.61417-1-hadess@hadess.net> References: <20240516090340.61417-1-hadess@hadess.net> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-GND-Sasl: hadess@hadess.net Error: BAD_FREE (CWE-763): [#def58] [important] bluez-5.75/tools/isotest.c:1461:5: address: Taking offset from "strchr(filename, 44)". bluez-5.75/tools/isotest.c:1461:5: assign: Assigning: "filename" = "strchr(filename, 44) + 1". bluez-5.75/tools/isotest.c:1536:2: incorrect_free: "free" frees incorrect pointer "filename". 1534| 1535| done: 1536|-> free(filename); 1537| 1538| syslog(LOG_INFO, "Exit"); --- tools/isotest.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/isotest.c b/tools/isotest.c index 58293133a304..fc1c26b23c3b 100644 --- a/tools/isotest.c +++ b/tools/isotest.c @@ -1457,8 +1457,11 @@ int main(int argc, char *argv[]) switch (mode) { case SEND: send_mode(filename, argv[optind + i], i, repeat); - if (filename && strchr(filename, ',')) - filename = strchr(filename, ',') + 1; + if (filename && strchr(filename, ',')) { + char *tmp = filename; + filename = strdup(strchr(filename, ',') + 1); + free(tmp); + } break; case RECONNECT: -- 2.44.0