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
So the value might be used directly for D-Bus property emission.
Otherwise D-Bus asserts and screws itself with:
ofonod[7427]: src/sms.c:handle_mwi()
process 7427: arguments to dbus_message_iter_append_basic() were
incorrect, assertion "*bool_p == 0 || *bool_p == 1" failed in file
../../dbus/dbus-message.c line 2549.
src/smsutil.c: In function ‘cbs_decode_text’:
src/smsutil.c:4116:16: error: comparison between signed and unsigned
integer expressions [-Werror=sign-compare]
If file name had anything in the name after addr-msgid, it would be
parsed as well. This is not what we want, since there could be temporary
files lying around.
If there are extraneous files in the directory when it is being loaded,
then the index used to rename the old file into the new file can get out
of sync with what the core expects.
sms_decode was never memsetting the returned structure, so if any
optional elements were present in the SMS (e.g. status report) then the
structure was not completely initialized.
This patch was generated by the following semantic patch
(http://coccinelle.lip6.fr/)
// <smpl>
@fix disable is_null,isnt_null1@
expression *E;
@@
- !E
+ E == NULL
// </smpl>
The reason for this parameter has ceased to exist quite a while ago.
Namely when the API allowed multiple SMS recipients. We prepared a
single set of segments and then reset the to address and reference. We
no longer allow multiple recipients and none of this is now needed.
The new name better reflects the function's purpose.
We need to export it, as for generating unique message naming (for
persistence and D-Bus object naming), we'll be using the
address.
Introduce DECLARE_SMS_ADDR_STR(), which declares a string variable of
the right size for passing to sms_assembly_decode_address(). This way
we detach each client having to have the knowledge of what the right
size is, leaving that decission to the infrastructure
provider. Updated couple of sites in smsutil.c to use it vs a raw
declaration.