From: Denis Kenzior Date: Fri, 13 Feb 2015 15:59:59 +0000 (-0600) Subject: smsutil: Add additional sanity check X-Git-Tag: upstream/1.17~62 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e2398b4dfaeaa62bb7b7ab81a74d860953da76c1;p=platform%2Fupstream%2Fofono.git 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. --- diff --git a/src/smsutil.c b/src/smsutil.c index 74afb651..9406a8a8 100644 --- a/src/smsutil.c +++ b/src/smsutil.c @@ -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);