summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2015-02-13 09:59:59 -0600
committerDenis Kenzior <denkenz@gmail.com>2015-02-13 09:59:59 -0600
commite2398b4dfaeaa62bb7b7ab81a74d860953da76c1 (patch)
tree8a5715112222fa94b57e7fd705770f4b2dd59cbf /src
parent42deee76a1299c4933b953400cb358af08497bc5 (diff)
downloadofono-e2398b4dfaeaa62bb7b7ab81a74d860953da76c1.tar.bz2
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.
Diffstat (limited to 'src')
-rw-r--r--src/smsutil.c5
1 files changed, 5 insertions, 0 deletions
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);