[PATCH] mm-modem-helpers-qmi: avoid SIGSEGV with mmcli --set-current-bands

Reinhard Speyerer rspmn at arcor.de
Mon Aug 19 14:31:23 UTC 2019


For devices which do not provide feature_extended_lte_band_preference
mm_modem_bands_to_qmi_band_preference() gets called from
mm_shared_qmi_set_current_bands() with extended_qmi_lte_bands
set to NULL which may cause a SIGSEGV in the memset() call in
mm_modem_bands_to_qmi_band_preference().

Avoid this by checking whether extended_qmi_lte_bands is non-NULL
before calling memset().

Reported-by: Nick <mips171 at icloud.com>
---
diff --git a/src/mm-modem-helpers-qmi.c b/src/mm-modem-helpers-qmi.c
index 86e1803b..a0bc4f4a 100644
--- a/src/mm-modem-helpers-qmi.c
+++ b/src/mm-modem-helpers-qmi.c
@@ -567,7 +567,8 @@ mm_modem_bands_to_qmi_band_preference (GArray *mm_bands,
 
     *qmi_bands = 0;
     *qmi_lte_bands = 0;
-    memset (extended_qmi_lte_bands, 0, extended_qmi_lte_bands_size * sizeof (guint64));
+    if (extended_qmi_lte_bands)
+        memset (extended_qmi_lte_bands, 0, extended_qmi_lte_bands_size * sizeof (guint64));
 
     for (i = 0; i < mm_bands->len; i++) {
         MMModemBand band;


More information about the ModemManager-devel mailing list