smsutil: Add additional sanity check

We make sure that after performing the UTF8 -> GSM conversion, the
number of GSM bytes is not greater than 11, which is the maximum
payload.
This commit is contained in:
Denis Kenzior 2015-02-13 09:59:59 -06:00
parent 42deee76a1
commit e2398b4dfa
1 changed files with 5 additions and 0 deletions

View File

@ -555,6 +555,11 @@ gboolean sms_encode_address_field(const struct sms_address *in, gboolean sc,
if (gsm == NULL)
return FALSE;
if (written > 11) {
g_free(gsm);
return FALSE;
}
r = pack_7bit_own_buf(gsm, written, 0, FALSE, &packed, 0, p);
g_free(gsm);