From 20c5d7fd922bfbf5d611c5c5b6cf78cb438437e0 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Thu, 13 Jun 2019 10:25:38 +0200 Subject: [PATCH] ublox: return error when no bands are parsed If load_current_bands_finish() returns a NULL GArray, we must set the GError or otherwise the daemon will segfault when the caller dereferences the GError: current_bands = MM_IFACE_MODEM_GET_INTERFACE (self)->load_current_bands_finish (self, res, &error); if (!current_bands) { /* Errors when getting current bands won't be critical */ mm_warn ("couldn't load current Bands: '%s'", error->message); g_error_free (error); } This may happen with an empty but balid +UACT response, e.g.: AT+UACT? +UACT: ,,, OK Or when it replies a full empty string: AT+UACT? OK --- plugins/ublox/mm-modem-helpers-ublox.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/ublox/mm-modem-helpers-ublox.c b/plugins/ublox/mm-modem-helpers-ublox.c index 8608960b..df6b6a26 100644 --- a/plugins/ublox/mm-modem-helpers-ublox.c +++ b/plugins/ublox/mm-modem-helpers-ublox.c @@ -1578,6 +1578,10 @@ mm_ublox_parse_uact_response (const gchar *response, g_array_unref (nums); } + if (!bands) + g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED, + "No known band selection values matched in +UACT response: '%s'", response); + return bands; }