From 54de04a828d945e8f081c7cd99161881736666b8 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Thu, 16 Aug 2012 00:47:59 -0500 Subject: [PATCH] util: Make sure to handle special empty strings Some SIMs contain an EFspn with the contents all set to 'filler' characters, e.g. 0xFF. We mistakenly do not handle these strings correctly. Aug 8 11:40:00 mx31tt01 daemon.info ofonod[622]: Aux: > AT+CRSM=176,28486,0,0,17\r Aug 8 11:40:00 mx31tt01 daemon.info ofonod[622]: Aux: < \r\n+CRSM: 144,0,FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\r\n\r\nOK\r\n Aug 8 11:40:00 mx31tt01 daemon.debug ofonod[622]: drivers/atmodem/sim.c:at_crsm_read_cb() crsm_read_cb: 90, 00, 17 Aug 8 11:40:00 mx31tt01 daemon.debug ofonod[622]: src/simfs.c:sim_fs_op_read_block_cb() bufoff: 0, dataoff: 0, tocopy: 17 Aug 8 11:40:00 mx31tt01 daemon.err ofonod[622]: EFspn read successfully, but couldn't parse --- src/util.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/util.c b/src/util.c index 057ae1cb..df9d4f01 100644 --- a/src/util.c +++ b/src/util.c @@ -1276,6 +1276,12 @@ char *sim_string_to_utf8(const unsigned char *buffer, int length) offset = 4; break; + case 0xff: /* Special case of empty string */ + num_chars = 0; + ucs2_offset = 0; + offset = 0; + break; + default: return NULL; }