aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2021-05-12 22:11:50 +0200
committerAleksander Morgado <aleksander@aleksander.es>2021-05-12 22:12:46 +0200
commitbb928dbf7409b445e6aaab994c571fb7d504a8d7 (patch)
tree6ee4f8952330b46243ad4c594002f116eae4319a
parentf916d075a78ddacd25e2db9c4eebb99b490482ff (diff)
iface-modem: fix segfault if attempting to switch slot and slots unsupported
Reported and fix suggested by Maxim Anisimov Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/368
-rw-r--r--src/mm-iface-modem.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c
index 2068dda9..245abe4c 100644
--- a/src/mm-iface-modem.c
+++ b/src/mm-iface-modem.c
@@ -1126,7 +1126,7 @@ handle_set_primary_sim_slot_auth_ready (MMBaseModem *self,
/* Validate SIM slot number */
sim_slot_paths = mm_gdbus_modem_get_sim_slots (ctx->skeleton);
- if (ctx->requested_sim_slot > g_strv_length ((gchar **)sim_slot_paths)) {
+ if (!sim_slot_paths || (ctx->requested_sim_slot > g_strv_length ((gchar **)sim_slot_paths))) {
g_dbus_method_invocation_return_error (ctx->invocation,
MM_CORE_ERROR,
MM_CORE_ERROR_INVALID_ARGS,