smsutil: Fix CR padding logic for 7-bit case

This commit is contained in:
Denis Kenzior 2012-09-17 11:48:03 -05:00
parent 134a35f697
commit 941257bec6
1 changed files with 11 additions and 3 deletions

View File

@ -4103,11 +4103,19 @@ char *cbs_decode_text(GSList *cbs_list, char *iso639_lang)
/*
* CR is a padding character, which means we can
* safely discard everything afterwards
* safely discard everything afterwards if there are
* only trailing CR characters.
*/
for (; i < written; i++, bufsize++) {
if (unpacked[i] == '\r')
break;
if (unpacked[i] == '\r') {
unsigned int t;
t = strspn((const char *) unpacked + i,
"\r");
if (t + i == written)
break;
}
buf[bufsize] = unpacked[i];
}