All of lore.kernel.org
 help / color / mirror / Atom feed
From: Szymon Janc <szymon.janc@codecoup.pl>
To: linux-bluetooth@vger.kernel.org,
	"Łukasz Rymanowski" <lukasz.rymanowski@codecoup.pl>
Cc: "Łukasz Rymanowski" <lukasz.rymanowski@codecoup.pl>
Subject: Re: [PATCH BlueZ] client: Fix possible stack corruption
Date: Mon, 11 May 2020 15:29:21 +0200	[thread overview]
Message-ID: <5352738.DvuYhMxLoT@ix> (raw)
In-Reply-To: <20200507214537.4504-1-lukasz.rymanowski@codecoup.pl>

Hi Łukasz,

On Thursday, 7 May 2020 23:45:37 CEST Łukasz 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(-)
> 
> 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") == 0) {
>  			if (var != DBUS_TYPE_BOOLEAN)
>  				return -EINVAL;
> -			if (prep_authorize)
> -				dbus_message_iter_get_basic(&value,
> -								
prep_authorize);
> +			if (prep_authorize) {
> +				int tmp;
> +
> +				dbus_message_iter_get_basic(&value, 
&tmp);
> +				*prep_authorize = !!tmp;
> +			}
>  		}
> 
>  		dbus_message_iter_next(&dict);

Applied, thanks.

-- 
pozdrawiam
Szymon Janc



      reply	other threads:[~2020-05-11 13:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-07 21:45 [PATCH BlueZ] client: Fix possible stack corruption Łukasz Rymanowski
2020-05-11 13:29 ` Szymon Janc [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5352738.DvuYhMxLoT@ix \
    --to=szymon.janc@codecoup.pl \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=lukasz.rymanowski@codecoup.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.