From a87a1f8ced054aba80ed6f15a0ce2c47827c394d Mon Sep 17 00:00:00 2001 From: Dmitry Skorykh Date: Fri, 24 Jun 2022 13:35:40 +0300 Subject: mm-sms-part-3gpp: sms_decode_text: avoid decoding an empty text message Fix segfault that can occur during message text decoding if there are no elements in SMS text --- src/mm-sms-part-3gpp.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/mm-sms-part-3gpp.c b/src/mm-sms-part-3gpp.c index aeb9decb..1bbe1a0a 100644 --- a/src/mm-sms-part-3gpp.c +++ b/src/mm-sms-part-3gpp.c @@ -252,6 +252,14 @@ sms_decode_text (const guint8 *text, gpointer log_object, GError **error) { + if (!text || len == 0) { + g_set_error (error, + MM_CORE_ERROR, + MM_CORE_ERROR_FAILED, + "Skipping SMS text: SMS text has no elements to decode"); + return NULL; + } + if (encoding == MM_SMS_ENCODING_GSM7) { g_autoptr(GByteArray) unpacked_array = NULL; guint8 *unpacked = NULL; -- cgit v1.2.3-70-g09d2