Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp63829pxa; Fri, 21 Aug 2020 00:56:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGs/efV7QxI2Mtl4d5K8EUK8+MVEKu9gUoaUchBN6MliZrulYGR+PXmd7zdE5mT9cSoSOI X-Received: by 2002:a17:907:7090:: with SMTP id yj16mr1643060ejb.73.1597996606213; Fri, 21 Aug 2020 00:56:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597996606; cv=none; d=google.com; s=arc-20160816; b=KlNS1/SLtjJscTuNlLzjDUdJUdOZiCUxf5gwkHi0LIAwil2mhS4bXTVvvRC05ZImsv SSryZj3vtKjxXmWbiqP14UPhPkvNvabD19jlca2QTHv5Ib2g4YU8NJg1vcZ2Fl5gBSZ7 gUOCdXKjKj8YfmCLFz63+Kh1bCIE+KkVSo+tn529hKdSa6mq0vm6LeWXAJmSsaYq3NTC 0si2xMljjDv8LaRTxVr+cUTj/0SiUOzu5kIWxVD+1wT0Q9VRRRkYKSzmMiekg9mkF2KU vGcVqXDWouF1JneQw1fBdKZ2m6uPMs4xiJ4mED4pRmnpzlVC9rbo14KRqd3YhZq0H3uU DbTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=z4BsBm4/JaybyWDiNEa/bs5RXulRrirwodkdVtO+qdI=; b=voUrv17dwyTsCr+NMnllHi2/6eA8L4NKxHR7MOO88rdMktJrCDo3Pnzdbw4bmlG2qe h4WPeWtMQzg80h69pw7JaU1pFfo99vDm1JZTjA/2zy0GLGlc8kSo4kxnfUyh48U3gHxP FvUDpPe3obVnk0ul5x8f1ZjGztlCWNT8HyqKWGVlgIhJ2yNiW2HTiUsaL09hef7ClrqE gPodmsxQylAMrlMRYk66XZtxKY8kjTrpWmWdkjQzxfBZlff+kggJ3Rvs/F1LjLjP73pq wL7mXJAWCEDzRx0N6DP/30L8SdlD8+cE7lnkck0Q86AuBqdOOOR/Bjqe1b+H9WpN1Jpg VDPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Svj3xn8v; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gq5si645911ejb.162.2020.08.21.00.56.14; Fri, 21 Aug 2020 00:56:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-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=@chromium.org header.s=google header.b=Svj3xn8v; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726332AbgHUHzY (ORCPT + 99 others); Fri, 21 Aug 2020 03:55:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728087AbgHUHzS (ORCPT ); Fri, 21 Aug 2020 03:55:18 -0400 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E2A0C061385 for ; Fri, 21 Aug 2020 00:55:18 -0700 (PDT) Received: by mail-pf1-x443.google.com with SMTP id d22so683894pfn.5 for ; Fri, 21 Aug 2020 00:55:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=z4BsBm4/JaybyWDiNEa/bs5RXulRrirwodkdVtO+qdI=; b=Svj3xn8vjjkw4I9/qdmVCZhG9PJ6VPW5bsS6q5zU/LDg1/Z0gbc3KUWZAuIzNly1S0 2aae/orbI5V6AYL2aw4N8gKOi6P6z4AvHYf6Q+Z4vQcOdkVpyYbA+SSbgJYBRN3AZIC+ 1apboJ9kUPbB2LXBNxTvr5xvWZcQdwMWK6EJg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=z4BsBm4/JaybyWDiNEa/bs5RXulRrirwodkdVtO+qdI=; b=uj2dtfqKyBDugkq42es2LQWCMEu3nYyGFTdoYyFDKd+uxpRuDGDCe2cztlFRvK2xdd hkUEGaQtjPJ95EYzPZueH2+i9SDQph5BObfZlINfuCeTO21zzGTx+XlnBnXgDyPP3y0p SSzSC80FFY79ZkVTXPS1BkDnN2A7ENEMdM5/umLabY+/g/Xaw/o9vp0gJh2dXWRxpyOC uihQsr3kHZ1pywRfC8G1Slh0XAHNJ8rfn7c66VK6UGwvU+06EHgkjqqEyBRQmdIlR3rF 41OpCpoSdqc+9DBkZJusPhW2KAeN8udj4xN2skQDOoDudAlz6UPW0OoVTO2Pm6qISLYb AWFQ== X-Gm-Message-State: AOAM5320/ATjtuRHe5g8vNp5iRJzFtaVbFGyMpgLfcvhH8pHp4+28NYf pRrIFJYS2Ai62QyGtzFfCdOtMgeMefyXBg== X-Received: by 2002:a05:6a00:90:: with SMTP id c16mr1543782pfj.200.1597996517807; Fri, 21 Aug 2020 00:55:17 -0700 (PDT) Received: from sonnysasaka-chrome.mtv.corp.google.com ([2620:15c:202:201:4a0f:cfff:fe66:e60c]) by smtp.gmail.com with ESMTPSA id f6sm1622827pfa.23.2020.08.21.00.55.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Aug 2020 00:55:17 -0700 (PDT) From: Sonny Sasaka To: linux-bluetooth@vger.kernel.org Cc: Miao-chen Chou , Yoni Shavit , Alain Michaud Subject: [PATCH BlueZ] sixaxis: Fix a crash caused by the return of udev_device_get_property_value Date: Fri, 21 Aug 2020 00:55:14 -0700 Message-Id: <20200821075514.20406-1-sonnysasaka@chromium.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Miao-chen Chou This adds a NULL check before calling sscanf(). Reviewed-by: Yoni Shavit Reviewed-by: Alain Michaud --- plugins/sixaxis.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/sixaxis.c b/plugins/sixaxis.c index 939fed759..996f85dd6 100644 --- a/plugins/sixaxis.c +++ b/plugins/sixaxis.c @@ -411,7 +411,7 @@ get_pairing_type_for_device(struct udev_device *udevice, uint16_t *bus, hid_id = udev_device_get_property_value(hid_parent, "HID_ID"); - if (sscanf(hid_id, "%hx:%hx:%hx", bus, &vid, &pid) != 3) + if (!hid_id || sscanf(hid_id, "%hx:%hx:%hx", bus, &vid, &pid) != 3) return NULL; cp = get_pairing(vid, pid); -- 2.26.2