[PATCH] ModemManager: SMS decoding cleanups
- From: Nathan Williams <njw google com>
- To: "networkmanager-list gnome org" <networkmanager-list gnome org>
- Subject: [PATCH] ModemManager: SMS decoding cleanups
- Date: Wed, 25 May 2011 19:35:06 -0400
This fixes a bug with decoding SMS messages with alphanumeric sender
addresses and some excessive pickiness in decoding the protocol field.
- Nathan
From 9fc44d9d0acac95b079e0ac7211d3092824226b0 Mon Sep 17 00:00:00 2001
From: Nathan Williams <njw chromium org>
Date: Wed, 25 May 2011 17:08:15 -0400
Subject: [PATCH] sms_decode_address(): Get the start and length correct for
alphanumeric data.
sms_parse_pdu(): Protocol ID doesn't actually affect decoding, so
don't fret about its value.
Change-Id: Ia4cb20c415aed1026bb7b8dd4daa8ae53dd749e8
---
src/mm-generic-gsm.c | 12 ++----------
1 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/src/mm-generic-gsm.c b/src/mm-generic-gsm.c
index 5b33ed7..2988356 100644
--- a/src/mm-generic-gsm.c
+++ b/src/mm-generic-gsm.c
@@ -4034,7 +4034,7 @@ sms_semi_octets_to_bcd_string (char *dest, const guint8 *octets, int num_octets)
*dest++ = '\0';
}
-/* len is in septets for gsm7 and in digits (semi-octets) for others */
+/* len is in semi-octets */
static char *
sms_decode_address (const guint8 *address, int len)
{
@@ -4047,7 +4047,7 @@ sms_decode_address (const guint8 *address, int len)
if (addrtype == 0xd0) {
guint8 *unpacked;
guint32 unpacked_len;
- unpacked = gsm_unpack (address + 1, len, 0, &unpacked_len);
+ unpacked = gsm_unpack (address, (len * 4) / 7, 0, &unpacked_len);
utf8 = (char *)mm_charset_gsm_unpacked_to_utf8 (unpacked,
unpacked_len);
g_free(unpacked);
@@ -4176,14 +4176,6 @@ sms_parse_pdu (const char *hexpdu)
return NULL;
}
- /* Only handle the basic protocol identifier */
- if (pdu[tp_pid_offset] != 0) {
- mm_err ("Unhandled protocol identifier: 0x%02x vs 0x00",
- pdu[tp_pid_offset]);
- g_free (pdu);
- return NULL;
- }
-
smsc_addr = sms_decode_address (&pdu[1], 2 * (pdu[0] - 1));
sender_addr = sms_decode_address (&pdu[msg_start_offset + 2],
pdu[msg_start_offset + 1]);
--
1.7.3.1
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]