[PATCH] libmm-glib,cdma: fix potential NULL dereference

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


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

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

Dan

> ---
>  libmm-glib/mm-cdma-manual-activation-properties.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/libmm-glib/mm-cdma-manual-activation-properties.c
> b/libmm-glib/mm-cdma-manual-activation-properties.c
> index 7d017c4a..5e7f3c28 100644
> --- a/libmm-glib/mm-cdma-manual-activation-properties.c
> +++ b/libmm-glib/mm-cdma-manual-activation-properties.c
> @@ -407,10 +407,11 @@ mm_cdma_manual_activation_properties_get_prl
> (MMCdmaManualActivationProperties *
>                                                gsize *prl_len)
>  {
>      g_return_val_if_fail (MM_IS_CDMA_MANUAL_ACTIVATION_PROPERTIES
> (self), NULL);
> -    if (self->priv->prl && prl_len)
> -        *prl_len = self->priv->prl->len;
>  
> -    return self->priv->prl->data;
> +    if (prl_len)
> +        *prl_len = (self->priv->prl ? self->priv->prl->len : 0);
> +
> +    return (self->priv->prl ? self->priv->prl->data : NULL);
>  }
>  
>  /**


More information about the ModemManager-devel mailing list