Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp8074695rwr; Wed, 10 May 2023 17:40:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7bkz83Z4cKHPX5q1Rf5vcSn9tP+PiRW5hJNKvXHPJIwmvH4aG9DIvsTRhgclj8h0y5rs3z X-Received: by 2002:a17:903:185:b0:1a1:e237:5f0 with SMTP id z5-20020a170903018500b001a1e23705f0mr25501830plg.58.1683765606831; Wed, 10 May 2023 17:40:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683765606; cv=none; d=google.com; s=arc-20160816; b=owhbEniGWlOzYUNWuWyKc21nV3fHR8GDZ9/0wS4/Xry1YPs4X+L9y2+gMNppFSIyOW y4S/Yb+Uc5wtbjUZzr05w2L6ws6GFbIWMTgsHag/p4E4wBSoh7+O+rpGGvv2T5Ibn8F+ fABYhX2WvRgJz9eooVxPXerD5hR5M48+oaYZxgOZGHF9C9rhiKB43T6peOPyI4olBvTX Om3Rao4G74R9be9DdXUJWg5KTWfQAb18c7kaCfmgAvwOBUNTcx/a7tdDp3TrbgqbV157 rpkPuwYqvgJkQm0SafUpY2LAwI3N96E0JOR8wFWJX4Gw6UL0kjCCD7kICG7E4IECMWGb IhNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:to:from:dkim-signature; bh=d396uE3VXLd6FUrRqmByZsOsI6lFw5B++H5Y/yOU+0I=; b=aCfexFMdqaC8SNSQ0WfS+WpfGIeXphCtjcUCwPSU9DD9FnyMZYTuaxY23X/E2dhoYD Fk+AWxqUcMM8TgyEFdCzLxOFxn/P2TKaHRg/8yH8DtI+EftvLcgV4BRLPP3avL2K5sbJ k3MMAw5EHI4/PLUHMY8o5EvEpcZPKJFC/0Az3O1SVkNbWSqoxr0xzS6c2Zxwd2rQ4cNv 94xsAswAi1wknVNhJqbw/UCzdG8oWMzab1IIoywBP/tPE5nyBesIVQimSVVbsesx1dq2 8th5Yhd1CYTeMHMy/KKpHLce7lCIgZeMjiInVXLvc51ibJhTs3V2k89Fciphj2yeCtk0 1hqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=MVYpPlVS; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jc12-20020a17090325cc00b001ac741db80asi3233520plb.236.2023.05.10.17.39.43; Wed, 10 May 2023 17:40:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=MVYpPlVS; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-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 S235984AbjEKACC (ORCPT + 99 others); Wed, 10 May 2023 20:02:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229447AbjEKACB (ORCPT ); Wed, 10 May 2023 20:02:01 -0400 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFBF035A6 for ; Wed, 10 May 2023 17:01:59 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-6435bbedb4fso8551210b3a.3 for ; Wed, 10 May 2023 17:01:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683763318; x=1686355318; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=d396uE3VXLd6FUrRqmByZsOsI6lFw5B++H5Y/yOU+0I=; b=MVYpPlVSJLKHgPXK+7Ry5KQSVGUn1yatLS8hrGoJxyFH1K3CGqH0cwNFWD2m2PLK/L kv1Ro6fyu94zQ67ndpSVEBdu5x+1ZnCZ8KsgdmNHc7kN5r+YmAXdFQC0xHBSZi2/h7lI HBMQ125soAgZeGvYvO+vMx9DkzEuQkbuGvFO2Q82+KNf6H8n399svzl1PdKNEFLI89H1 W0WPtktwbv0n2zFZUv4q3hr8LOiE1J+T7NakKRu8Eiw7gCvuZApnfnae3Owery81Ptrk bAdnFsg4HgPLGHgWltyqllA+H1TUgrHIJe254VtydVujXb53anDmtUskdXGQhwJ9YfoY KUQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683763318; x=1686355318; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=d396uE3VXLd6FUrRqmByZsOsI6lFw5B++H5Y/yOU+0I=; b=biBZGjzsBdRdsTYGs7hwMP2pUE1r0iq97Z907lstkEQQjqjuSCIciMSYRUhtr212yB oBlF2tq7UyElRnkaTS4/hmtJNXFQ7shTBfj55HWgdY/U3NKMc6iGGZhJpRLR3WAAOTgv +cmTDOFMvOqGsQ/LDX8bmwvyT5k6Zply1YCd1ybkRCZigvfFfnKjSso7tDsjqgu82Te9 UcUayxd5DaP1Pu3CQ1r1XyOb3zD1MW+6as0s+WkUFIdO0Y3UmPgOlNLnXPJS3YjzzRMg 78F6mMS4vexWwIeKLjy+61VSJtxtU1uHRBwDjQPAHJZssvqb7CLHHhv/GM6bJRMObTzf SkRA== X-Gm-Message-State: AC+VfDwaHZRy9lEYBAUM9aYgefgXEaZfUuo/Q2bvIQ8z0YWx5qt7BxpJ huf02M3Cf7XC5dpns9MXc/cEdabZ2/4= X-Received: by 2002:a05:6a20:1608:b0:f2:c2a3:3a1 with SMTP id l8-20020a056a20160800b000f2c2a303a1mr25047930pzj.43.1683763318038; Wed, 10 May 2023 17:01:58 -0700 (PDT) Received: from lvondent-mobl4.. (c-71-59-129-171.hsd1.or.comcast.net. [71.59.129.171]) by smtp.gmail.com with ESMTPSA id g15-20020a63f40f000000b0053031f7a367sm3761604pgi.85.2023.05.10.17.01.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 May 2023 17:01:56 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ 1/2] client/player: Fix crashes accessing metadata Date: Wed, 10 May 2023 17:01:54 -0700 Message-Id: <20230511000155.3721222-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz If metadata is not set the respective iovec is left NULL so it needs to be checked before accessing its fields. --- client/player.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/player.c b/client/player.c index f055ff941569..091d7005f42a 100644 --- a/client/player.c +++ b/client/player.c @@ -1743,7 +1743,7 @@ static void append_properties(DBusMessageIter *iter, DBUS_TYPE_BYTE, &cfg->caps->iov_base, cfg->caps->iov_len); - if (cfg->meta->iov_len) { + if (cfg->meta && cfg->meta->iov_len) { g_dbus_dict_append_basic_array(&dict, DBUS_TYPE_STRING, &meta, DBUS_TYPE_BYTE, &cfg->meta->iov_base, cfg->meta->iov_len); @@ -1850,7 +1850,8 @@ static DBusMessage *endpoint_select_properties_reply(struct endpoint *ep, cfg->target_latency = preset->target_latency; /* Copy metadata */ - iov_append(&cfg->meta, cfg->ep->meta->iov_base, cfg->ep->meta->iov_len); + if (ep->meta) + iov_append(&cfg->meta, ep->meta->iov_base, ep->meta->iov_len); if (preset->qos.phy) /* Set QoS parameters */ -- 2.40.0