Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1873772ybk; Mon, 11 May 2020 06:29:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxyRZZ6LQP21II6yFsmw0sdJayWDsGoRFSqpRl7ooiCN3SRCaH79aaQHh4DzrLn+eHDNE8R X-Received: by 2002:a17:906:9419:: with SMTP id q25mr2755960ejx.111.1589203796881; Mon, 11 May 2020 06:29:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589203796; cv=none; d=google.com; s=arc-20160816; b=TdKRpGv2LVa8MNmiI5akw3jmhkLoFQmWWqAfznY+/SsCvammgytAvHTKktf3AlKzUi 2FBSSQH8VIBeF9Lnrjjv1FLHcEwwlZbwcMICwQIK78EIrv5+PpnlFuC7fPP9DB0Kj0W4 j/LhOknzh1Wcfv2IXvNW3nx6cUzONcjWwprdUJdRswUw53brxb66gXtcLI54pjbOii64 ie2SpYXTHlUsihXlhNsnn9J2lkBupgXfBvZLDj6Ih0JavGMGXjR30k8CEPIbwR9WTQ74 xoRBMbitBKosxGBMnxoR6YrjONLKOwCW/k7cOcazhBymZ4GZl2+lSkGoNGSBO0gv7LDF rOmQ== 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 :references:in-reply-to:organization:message-id:date:subject:cc:to :from:dkim-signature; bh=9cc8H5Zx2HvvjN5kr+c1/D9dKj92x5FUvPHEEDebnOQ=; b=yBY/31JlM/Ahs5b7ARH/QP7YbT05eLXUzGDCuiTbMgCESSD7UlPrtg/5NCX4jw/1T2 qgzxPBW/GkJ9q1fDHoQVA+T6/LVTCIdlqPLAu3xCoSJlsrwMsTR18wvLnSxgEfooeJn/ Sta9fOCPdVOh3LMX9G/Bueu5XYUq2Kf2wm4z5T61ybVz18PU/+ScLYhYJ0jXFzrovU8o JRfpVUD1/Fo5PrTs78vhDEqUwJeOibBAuFGA4e5nMaF+vkpYS4JmhzBUdaiFq0EY5TsR BdYBVpPkaUZjsdqCY2kgiF+5ifI15rj3yvHLTgPWlH4FqVh/7X1lfgOsYHu+vtOwn5gj XKtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codecoup-pl.20150623.gappssmtp.com header.s=20150623 header.b=uVbClvNF; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 23si356847edx.48.2020.05.11.06.29.31; Mon, 11 May 2020 06:29:56 -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=@codecoup-pl.20150623.gappssmtp.com header.s=20150623 header.b=uVbClvNF; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726934AbgEKN30 (ORCPT + 99 others); Mon, 11 May 2020 09:29:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726013AbgEKN30 (ORCPT ); Mon, 11 May 2020 09:29:26 -0400 Received: from mail-lf1-x141.google.com (mail-lf1-x141.google.com [IPv6:2a00:1450:4864:20::141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05801C061A0C for ; Mon, 11 May 2020 06:29:26 -0700 (PDT) Received: by mail-lf1-x141.google.com with SMTP id 8so4797576lfp.4 for ; Mon, 11 May 2020 06:29:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codecoup-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:organization:in-reply-to :references:mime-version:content-transfer-encoding; bh=9cc8H5Zx2HvvjN5kr+c1/D9dKj92x5FUvPHEEDebnOQ=; b=uVbClvNFTFPq7Od7m8ue38PovU+JWSpbU+jWyoeqxthZw2mzVzctmemoeckir29suO 48pp3LhfBOFf34BRYpUEudFRJLowLLgORKVChUYGTtVPhMp3hu8HY+rrxnV88RORbwj8 QI17nMO95JaItnnTTHjTGaJnLkHDmcZD7+zNCl2rlD8+QNzfR1k9Z2L6R5KmivRHyfF9 m0td9HafLSoJE18VY8dzGV/c4+istSmzvbEWwBJIIgscvC8FZQX8XOTg+KQDNJS0OHTd BKaZ1vJAe2whkcccTPJ7abLI2kV5hm7JfpgKTcP+8dhDQ0+HjDi/Pp4wsy+Chgf0+k3y kmRg== 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:organization :in-reply-to:references:mime-version:content-transfer-encoding; bh=9cc8H5Zx2HvvjN5kr+c1/D9dKj92x5FUvPHEEDebnOQ=; b=VLYhD7PEMOax2oX/ieQEy2IUvBdqoRzM/KrZzb544LJBY8kdSPvhXVyIj/MwORkkYY x/X9oYx4+oeoglfZq84FDTu5rVyWUacaWMsTziH89ljahEJDyjzrwSsreKrO8WAYmx// DK8KMFXS2ASiTA8LZIIcBmWAuH4gYw7DZGcBpFtsVoVi3Ti1sH7CXQUW3Aa1/iUBflVF vT35xqHDuqclqo9c1C9w/i5QZv6J76cx8+EdG/Tt9x9feD+/ikODYTyd52+rhxm+2+Xi D7rcCm2iX6ozgMMZWNI/yUUc9eFujYfqpQAw6dubSlAoufdO/o0UyYC46iadH6UvGXuH wKsg== X-Gm-Message-State: AOAM5331v4ULh091Mx46WPNIyK4E0nnBog0WITXc3dsmeEVjVQHZKL/e r8VWnbU69pmCqLyAWwPQHj0Dcb3lzJI= X-Received: by 2002:ac2:59ce:: with SMTP id x14mr11042168lfn.183.1589203764164; Mon, 11 May 2020 06:29:24 -0700 (PDT) Received: from ix.localnet ([95.143.243.62]) by smtp.gmail.com with ESMTPSA id h6sm10322750ljj.29.2020.05.11.06.29.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 May 2020 06:29:22 -0700 (PDT) From: Szymon Janc To: linux-bluetooth@vger.kernel.org, =?utf-8?B?xYF1a2Fzeg==?= Rymanowski Cc: =?utf-8?B?xYF1a2Fzeg==?= Rymanowski Subject: Re: [PATCH BlueZ] client: Fix possible stack corruption Date: Mon, 11 May 2020 15:29:21 +0200 Message-ID: <5352738.DvuYhMxLoT@ix> Organization: CODECOUP In-Reply-To: <20200507214537.4504-1-lukasz.rymanowski@codecoup.pl> References: <20200507214537.4504-1-lukasz.rymanowski@codecoup.pl> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi =C5=81ukasz, On Thursday, 7 May 2020 23:45:37 CEST =C5=81ukasz Rymanowski wrote: > DBUS_TYPE_BOOLEAN is 'int', which does not have to be the same size as > 'bool'. > On architecture where bool is smaller than in, getting prepare-authorize > will corrupt the stack > --- > client/gatt.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) >=20 > diff --git a/client/gatt.c b/client/gatt.c > index 416eda953..9d35b54fa 100644 > --- a/client/gatt.c > +++ b/client/gatt.c > @@ -1860,9 +1860,12 @@ static int parse_options(DBusMessageIter *iter, > uint16_t *offset, uint16_t *mtu, } else if (strcasecmp(key, > "prepare-authorize") =3D=3D 0) { > if (var !=3D DBUS_TYPE_BOOLEAN) > return -EINVAL; > - if (prep_authorize) > - dbus_message_iter_get_basic(&value, > - =09 prep_authorize); > + if (prep_authorize) { > + int tmp; > + > + dbus_message_iter_get_basic(&value,=20 &tmp); > + *prep_authorize =3D !!tmp; > + } > } >=20 > dbus_message_iter_next(&dict); Applied, thanks. =2D-=20 pozdrawiam Szymon Janc