summaryrefslogtreecommitdiffstats
path: root/src/util.c
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2012-08-16 00:47:59 -0500
committerDenis Kenzior <denkenz@gmail.com>2012-08-16 00:47:59 -0500
commit54de04a828d945e8f081c7cd99161881736666b8 (patch)
treed57bf348b6f97145f27d8e2180de9be0a4e6f2f7 /src/util.c
parentdf05259e90d6d82128f197c70277242c385face5 (diff)
downloadofono-54de04a828d945e8f081c7cd99161881736666b8.tar.bz2
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
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c6
1 files changed, 6 insertions, 0 deletions
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;
}