From: Denis Kenzior Date: Thu, 16 Aug 2012 05:47:59 +0000 (-0500) Subject: util: Make sure to handle special empty strings X-Git-Tag: 1.11~42 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=54de04a828d945e8f081c7cd99161881736666b8;p=platform%2Fupstream%2Fofono.git 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 --- diff --git a/src/util.c b/src/util.c index 057ae1c..df9d4f0 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; }