Check if unpacking of an sms buffer succeeds
PATCH 1/1 Check if unpacking of an sms buffer succeeds
And here's one from a coworker that was necessary in order for him to make use of oFono..
From: Sjoerd Simons <[email protected]>
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_plain;h=e457a55999f0d52393e048ff68763fc3b2fd1f44
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...
---
src/smsutil.c +3 -2
@@ -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 )
Resending, as the previous patch was apparently mangled.
From 5a0e8a4d4947d8252df83f0d6c7226d944c83cf2 Mon Sep 17 00:00:00 2001
From: Sjoerd Simons <[email protected]>
Date: Fri, 2 Oct 2009 20:07:56 -0400
Subject: [PATCH] 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...
--- src/smsutil.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
src/smsutil.c +3 -2
@@ -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 )
Signature · 1 line
1.6.4.3