[PATCH] libmm-glib,cdma: fix potential NULL dereference
Ben Chan
benchan at chromium.org
Fri Aug 11 21:19:35 UTC 2017
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.
---
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);
}
/**
--
2.14.0.434.g98096fd7a8-goog
More information about the ModemManager-devel
mailing list