And here's one from a coworker that was necessary in order for him to
make use of oFono..
From: Sjoerd Simons <sjoerd.simons(a)collabora.co.uk>
Date: Fri, 2 Oct 2009 23:32:37 +0000 (+0100)
Subject: Check if unpacking of an sms buffer succeeds
X-Git-Url:
http://git.collabora.co.uk/?p=user%2Fsjoerd%2Fofono.git;a=commitdiff_plai...
Check if unpacking of an sms buffer succeeds
There are cases in which sms unpack_7bit_own_buf can fail (for example when
receiving an empty sms), in that case bail out instead of crashing...
---
diff --git a/src/smsutil.c b/src/smsutil.c
index 106a39a..f389d29 100644
--- a/src/smsutil.c
+++ b/src/smsutil.c
@@ -2140,9 +2140,10 @@ char *sms_decode_text(GSList *sms_list)
guint8 single_shift = 0;
int max_chars = sms_text_capacity_gsm(udl, taken);
- unpack_7bit_own_buf(ud + taken, udl_in_bytes - taken,
+ if (unpack_7bit_own_buf(ud + taken, udl_in_bytes - taken,
taken, FALSE, max_chars,
- &written, 0, buf);
+ &written, 0, buf) == NULL)
+ break;
/* Take care of improperly split fragments */
if (buf[written-1] == 0x1b)