From 6aec0a6c8052107e70faa3c9c5bd42dd35266604 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Wed, 16 Feb 2022 21:47:26 +0100 Subject: [PATCH] sim-mbim: report error if decoding EID from APDU response fails Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/510 --- src/mm-sim-mbim.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mm-sim-mbim.c b/src/mm-sim-mbim.c index f9baafc0..b0addb2e 100644 --- a/src/mm-sim-mbim.c +++ b/src/mm-sim-mbim.c @@ -475,9 +475,13 @@ check_uicc_apdu_ready (MbimDevice *device, &apdu_response, &error)) ctx->saved_error = error; - else + else { ctx->eid = mm_decode_eid ((const gchar *)(apdu_response + EID_APDU_HEADER), apdu_response_size - EID_APDU_HEADER); + if (!ctx->eid) + ctx->saved_error = g_error_new (MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS, + "Invalid APDU response: unable to decode EID"); + } /* always go on to the close channel step, even on error */ ctx->step++;