[PATCH v2] libmm-glib,sms-properties: fix potential NULL dereference

Dan Williams dcbw at redhat.com
Fri Aug 11 22:43:11 UTC 2017


On Fri, 2017-08-11 at 14:16 -0700, Ben Chan wrote:
> This patch fixes a potential NULL referenece issue in
> mm_sms_properties_get_data() where it accesses `self->priv->data-
> >data'
> when `self->priv->data' could be potentially NULL.

Thanks, pushed to git master and mm-1-6.

Dan

> ---
>  libmm-glib/mm-sms-properties.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/libmm-glib/mm-sms-properties.c b/libmm-glib/mm-sms-
> properties.c
> index da4aa804..b0ff5a3b 100644
> --- a/libmm-glib/mm-sms-properties.c
> +++ b/libmm-glib/mm-sms-properties.c
> @@ -157,10 +157,10 @@ mm_sms_properties_get_data (MMSmsProperties
> *self,
>  {
>      g_return_val_if_fail (MM_IS_SMS_PROPERTIES (self), NULL);
>  
> -    if (self->priv->data && data_len)
> -        *data_len = self->priv->data->len;
> +    if (data_len)
> +        *data_len = (self->priv->data ? self->priv->data->len : 0);
>  
> -    return self->priv->data->data;
> +    return (self->priv->data ? self->priv->data->data : NULL);
>  }
>  
>  /**


More information about the ModemManager-devel mailing list