summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2010-07-08 13:36:42 -0500
committerDenis Kenzior <denkenz@gmail.com>2010-07-08 14:27:33 -0500
commite6d6f802a57b8fdca70b0ac5a7f67381d4fe51c0 (patch)
treeb2bc0f552625b7a2f5fb1f0ed38dd392dd641951 /src
parent98a8b4ecff3861ce14acbc7c89231e9eb4db21a9 (diff)
downloadofono-e6d6f802a57b8fdca70b0ac5a7f67381d4fe51c0.tar.bz2
smsutil: Fix valgrind complaint
SMS cannot be split over GSM extension chars, however on the last segment this code was causing us to overflow the buffer and resulted in valgrind complaining.
Diffstat (limited to 'src')
-rw-r--r--src/smsutil.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/smsutil.c b/src/smsutil.c
index 14dc43a0..e41c0416 100644
--- a/src/smsutil.c
+++ b/src/smsutil.c
@@ -2936,12 +2936,12 @@ GSList *sms_text_prepare(const char *utf8, guint16 ref,
if (gsm_encoded) {
chunk = sms_text_capacity_gsm(160, offset);
- if (gsm_encoded[written + chunk - 1] == 0x1b)
- chunk -= 1;
-
if (left < chunk)
chunk = left;
+ if (gsm_encoded[written + chunk - 1] == 0x1b)
+ chunk -= 1;
+
template.submit.udl = chunk + (offset * 8 + 6) / 7;
pack_7bit_own_buf(gsm_encoded + written, chunk,
offset, FALSE, NULL, 0,