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.
This commit is contained in:
Denis Kenzior 2010-07-08 13:36:42 -05:00
parent 98a8b4ecff
commit e6d6f802a5
1 changed files with 3 additions and 3 deletions

View File

@ -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,