From b7820cf6e15eb245d4726f8cfbe20ce24466188b Mon Sep 17 00:00:00 2001 From: Nathan Williams Date: Thu, 23 Jun 2011 18:01:46 -0400 Subject: [PATCH] gsm: handle case of entirely empty SPN correctly BUG=none TEST=Insert a SIM with a present but empty (all 0xFF) SPN and check the system log for a (lack of) assertion errors from mm_charset_gsm_unpacked_to_utf8(). Change-Id: I1250494b9757c9bfdce56402a4471c598f41223f Reviewed-on: http://gerrit.chromium.org/gerrit/3139 Reviewed-by: Eric Shienbrood Tested-by: Nathan J. Williams --- src/mm-generic-gsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mm-generic-gsm.c b/src/mm-generic-gsm.c index d814c57c..c3c3d472 100644 --- a/src/mm-generic-gsm.c +++ b/src/mm-generic-gsm.c @@ -2002,7 +2002,7 @@ get_spn_done (MMAtSerialPort *port, } /* Remove the FF filler at the end */ - while (bin[buflen - 1] == (char)0xff) + while (buflen > 1 && bin[buflen - 1] == (char)0xff) buflen--; /* First byte is metadata; remainder is GSM-7 unpacked into octets; convert to UTF8 */