diff options
author | Dmitry Skorykh <dmitry.skorykh@emlid.com> | 2022-06-24 13:35:40 +0300 |
---|---|---|
committer | Dmitry Skorykh <dmitry.skorykh@emlid.com> | 2022-06-27 12:09:15 +0300 |
commit | a87a1f8ced054aba80ed6f15a0ce2c47827c394d (patch) | |
tree | 2e3d1155d1b5e02a68818360fa5db58e6d71ea20 /src | |
parent | db33a43b4504d463eb0ad0642f7157b9f6e0f33a (diff) |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-sms-part-3gpp.c | 8 |
1 files changed, 8 insertions, 0 deletions
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; |