mirror of git://git.sysmocom.de/ofono
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:
parent
98a8b4ecff
commit
e6d6f802a5
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue