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

Ben Chan benchan at chromium.org
Fri Aug 11 18:32:42 UTC 2017


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.
---
 libmm-glib/mm-sms-properties.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libmm-glib/mm-sms-properties.c b/libmm-glib/mm-sms-properties.c
index da4aa804..d66e0dab 100644
--- a/libmm-glib/mm-sms-properties.c
+++ b/libmm-glib/mm-sms-properties.c
@@ -157,7 +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)
+    if (!self->priv->data)
+        return NULL;
+
+    if (data_len)
         *data_len = self->priv->data->len;
 
     return self->priv->data->data;
-- 
2.14.0.434.g98096fd7a8-goog



More information about the ModemManager-devel mailing list