Linux bluetooth development
 help / color / mirror / Atom feed
From: Szymon Janc <szymon.janc@tieto.com>
To: Marcin Kraglak <marcin.kraglak@tieto.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] shared/gatt: Fix freeing uninitialized attributes
Date: Fri, 16 May 2014 14:36:18 +0200	[thread overview]
Message-ID: <2765194.znkhuiMyg3@uw000953> (raw)
In-Reply-To: <1400234827-24438-1-git-send-email-marcin.kraglak@tieto.com>

Hi Marcin,

On Friday 16 of May 2014 12:07:07 Marcin Kraglak wrote:
> Don't free uninitialized attributes. It could cause NULL pointer
> dereference.
> ---
>  src/shared/gatt-db.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/src/shared/gatt-db.c b/src/shared/gatt-db.c
> index d9f63be..36316af 100644
> --- a/src/shared/gatt-db.c
> +++ b/src/shared/gatt-db.c
> @@ -99,6 +99,10 @@ static void attribute_destroy(void *data)
>  {
>  	struct gatt_db_attribute *attribute = data;
>  
> +	/* Attribute was not initialized by user */
> +	if (!attribute)
> +		return;
> +
>  	free(attribute->value);
>  	free(attribute);
>  }
> 

Applied, thanks.

-- 
Best regards, 
Szymon Janc

  reply	other threads:[~2014-05-16 12:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-16 10:07 [PATCH] shared/gatt: Fix freeing uninitialized attributes Marcin Kraglak
2014-05-16 12:36 ` Szymon Janc [this message]
2014-05-16 15:17 ` Marcel Holtmann
2014-05-16 16:24   ` Szymon Janc

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=2765194.znkhuiMyg3@uw000953 \
    --to=szymon.janc@tieto.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcin.kraglak@tieto.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox