diff options
author | Tommi Kenakkala <tommi.kenakkala@tieto.com> | 2015-02-13 17:50:16 +0200 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2015-02-13 09:49:39 -0600 |
commit | 2af3c733b7a31d755d7dec5b59113b9c73209d16 (patch) | |
tree | 80248de64755263a8abcbab9e8ae55745646d23c /src/smsutil.h | |
parent | 604fa223f4a1b7abdf44b5da6c5ca45684f3feac (diff) | |
download | ofono-2af3c733b7a31d755d7dec5b59113b9c73209d16.tar.bz2 |
sms: Fix alphanumeric TP-OA handling
TP-OA max length comparisons were incorrect because TP-OA's 7-bit
coded octets transport eleven 8-bit chars. The current code assumed
only 10 chars were possible.
The patch
- increases the array size to 23, (maximum of 22 bytes for UTF8
encoding + null terminator)
- Updates the sanity check to account for the correct maximum
- For encoding, checks the maximum length in UTF8 characters instead of
bytes
Diffstat (limited to 'src/smsutil.h')
-rw-r--r-- | src/smsutil.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/smsutil.h b/src/smsutil.h index b1001f8f..f293350f 100644 --- a/src/smsutil.h +++ b/src/smsutil.h @@ -220,7 +220,11 @@ enum cbs_geo_scope { struct sms_address { enum sms_number_type number_type; enum sms_numbering_plan numbering_plan; - char address[21]; /* Max 20 in semi-octet, 11 in alnum */ + /* + * An alphanum TP-OA is 10 7-bit coded octets, which can carry + * 11 8-bit characters. 22 bytes + terminator in UTF-8. + */ + char address[23]; }; struct sms_scts { |