aboutsummaryrefslogtreecommitdiff
path: root/src/mm-sms-part-cdma.c
AgeCommit message (Collapse)Author
2023-03-30sms-part-cdma: fix invalid reads due to wrong byte counts in read_bitsAleksander Morgado
==174467== Invalid read of size 1 ==174467== at 0x10B80C: read_bits (mm-sms-part-cdma.c:255) ==174467== by 0x10B886: read_bits (mm-sms-part-cdma.c:260) ==174467== by 0x10DC2F: read_bearer_data_user_data (mm-sms-part-cdma.c:882) ==174467== by 0x10DC2F: read_bearer_data (mm-sms-part-cdma.c:1000) ==174467== by 0x10DC2F: mm_sms_part_cdma_new_from_binary_pdu (mm-sms-part-cdma.c:1180) ==174467== by 0x10DF24: mm_sms_part_cdma_new_from_pdu (mm-sms-part-cdma.c:331) ==174467== by 0x10A91D: common_test_valid_part_from_hexpdu (test-sms-part-cdma.c:114) ==174467== by 0x10B0AC: common_test_valid_part_from_pdu (test-sms-part-cdma.c:126) ==174467== by 0x10B0AC: test_invalid_ascii_user_data (test-sms-part-cdma.c:412) ==174467== by 0x4A0264D: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2) ==174467== by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2) ==174467== by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2) ==174467== by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2) ==174467== by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2) ==174467== by 0x4A02B1A: g_test_run_suite (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2) ==174467== Address 0x51a6457 is 0 bytes after a block of size 7 alloc'd ==174467== at 0x48455EF: calloc (vg_replace_malloc.c:1328) ==174467== by 0x49DF6C0: g_malloc0 (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2) ==174467== by 0x48ABD24: mm_utils_hexstr2bin (mm-common-helpers.c:1884) ==174467== by 0x10DF06: mm_sms_part_cdma_new_from_pdu (mm-sms-part-cdma.c:325) ==174467== by 0x10A91D: common_test_valid_part_from_hexpdu (test-sms-part-cdma.c:114) ==174467== by 0x10B0AC: common_test_valid_part_from_pdu (test-sms-part-cdma.c:126) ==174467== by 0x10B0AC: test_invalid_ascii_user_data (test-sms-part-cdma.c:412) ==174467== by 0x4A0264D: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2) ==174467== by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2) ==174467== by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2) ==174467== by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2) ==174467== by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2) ==174467== by 0x4A02B1A: g_test_run_suite (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2)
2023-03-30sms-part-cdma: fix invalid memory read when parsing empty ascii textAleksander Morgado
Same fix also applied to latin encoded text as it also makes sense there. ==158856== Invalid read of size 1 ==158856== at 0x10B814: read_bits (mm-sms-part-cdma.c:257) ==158856== by 0x10DB07: read_bearer_data_user_data (mm-sms-part-cdma.c:878) ==158856== by 0x10DB07: read_bearer_data (mm-sms-part-cdma.c:990) ==158856== by 0x10DB07: mm_sms_part_cdma_new_from_binary_pdu (mm-sms-part-cdma.c:1170) ==158856== by 0x10DE54: mm_sms_part_cdma_new_from_pdu (mm-sms-part-cdma.c:333) ==158856== by 0x10A916: common_test_invalid_part_from_hexpdu (test-sms-part-cdma.c:90) ==158856== by 0x10A916: common_test_invalid_part_from_pdu (test-sms-part-cdma.c:104) ==158856== by 0x4A0264D: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2) ==158856== by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2) ==158856== by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2) ==158856== by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2) ==158856== by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2) ==158856== by 0x4A02B1A: g_test_run_suite (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2) ==158856== by 0x4A02BBC: g_test_run (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2) ==158856== by 0x10A509: main (test-sms-part-cdma.c:595) ==158856== Address 0x51a627b is 0 bytes after a block of size 11 alloc'd ==158856== at 0x48455EF: calloc (vg_replace_malloc.c:1328) ==158856== by 0x49DF6C0: g_malloc0 (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2) ==158856== by 0x48ABD24: mm_utils_hexstr2bin (mm-common-helpers.c:1884) ==158856== by 0x10DE36: mm_sms_part_cdma_new_from_pdu (mm-sms-part-cdma.c:327) ==158856== by 0x10A916: common_test_invalid_part_from_hexpdu (test-sms-part-cdma.c:90) ==158856== by 0x10A916: common_test_invalid_part_from_pdu (test-sms-part-cdma.c:104) ==158856== by 0x4A0264D: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2) ==158856== by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2) ==158856== by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2) ==158856== by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2) ==158856== by 0x4A023B4: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2) ==158856== by 0x4A02B1A: g_test_run_suite (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2) ==158856== by 0x4A02BBC: g_test_run (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7400.2) ==158856==
2023-03-30sms-part-cdma: fix warning when attempting g_convert() with NULL inputAleksander Morgado
GLib-CRITICAL **: 21:21:51.419: g_convert: assertion 'str != NULL' failed Program received signal SIGTRAP, Trace/breakpoint trap. 0x00007ffff7db3e82 in g_logv () from /lib/x86_64-linux-gnu/libglib-2.0.so.0 (gdb) bt #0 0x00007ffff7db3e82 in g_logv () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #1 0x00007ffff7db40ef in g_log () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #2 0x00007ffff7d8a5da in g_convert () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #3 0x00005555555592cf in read_bearer_data_user_data (log_object=0x0, subparameter=<optimized out>, sms_part=0x555555578000) at ../src/mm-sms-part-cdma.c:929 #4 read_bearer_data (log_object=0x0, parameter=<optimized out>, sms_part=0x555555578000) at ../src/mm-sms-part-cdma.c:982 #5 mm_sms_part_cdma_new_from_binary_pdu
2023-03-30sms-part-cdma: fix assertion in cause codes parameter idAleksander Morgado
ERROR:../src/mm-sms-part-cdma.c:678:read_cause_codes: assertion failed: (parameter->parameter_id == PARAMETER_ID_BEARER_REPLY_OPTION)
2021-11-26sms-part-cdma: remove trailing whitespacesAleksander Morgado
2021-11-21sms-part-cdma: merge WDP multipart CDMA WAP messages.Matthew Via
CDMA WAPs have multipart message information in a 3 byte header in-band with the user data, as described in WAP-259-WDP-20010614-a. Set the message concat parameters and use the message-id as the reference.
2021-02-23charsets: use new bytearray_from_utf8() instead of byte_array_append()Aleksander Morgado
2021-02-23libmm-glib,common-helpers: make hexstr2bin() return a guint8 arrayAleksander Morgado
It makes much more sense than returning a gchar array, as gchar is signed.
2021-02-23libmm-glib,common-helpers: make hexstr2bin() accept input string lengthAleksander Morgado
Optionally given explicitly, and -1 can be used to assume it's NUL-terminated.
2021-02-23libmm-glib,common-helpers: make hexstr2bin() return a GErrorAleksander Morgado
This util method checks whether the input string is a valid hex string, so make sure we return a GError on failure.
2021-02-23charsets: don't allow quoting in byte_array_append()Aleksander Morgado
There's no point in adding a quoting option to this method; if the caller needs the appended string quoted, it should quote it before passing it to this method. It was nowhere used anyway.
2020-11-20sms: fix 7-bit ASCII SMS decodingDavid Leonard
Fixes an issue where (5+8n)-character long SMS messages received on a CDMA network would be dropped with a "cannot read user data" error, while other length SMS messages would be delivered fine. Fix thanks to Peter Hunt
2020-08-26sms: fix CMDA SMS UTF-8 translationDavid Leonard
Fixes incoming SMS translation issue seen on MC7354 when translating contents from Latin-1 encoding to UTF-8, because the encoding parameter "ISO−8859−1" used U+2212 (MINUS SIGN) instead of U+002D (HYPHEN-MINUS). [mm-sms-part-cdma.c:873] read_bearer_data_user_data(): text/data: ignored (latin to UTF-8 conversion error): 0: Conversion from character set 'ISO−8859−1' to 'UTF-8' is not supported Fix thanks to Peter Hunt
2020-04-08charsets: report GError in byte_array_append() failuresAleksander Morgado
2020-04-08sms-part-cdma: port to use object loggingAleksander Morgado
2020-01-31sms-part-cdma: fix warnings with -Wswitch-defaultAleksander Morgado
mm-sms-part-cdma.c: In function ‘mm_sms_part_cdma_new_from_binary_pdu’: mm-sms-part-cdma.c:1138:5: error: switch missing default case [-Werror=switch-default] 1138 | switch (message_type) { | ^~~~~~
2017-10-26sms-cdma-part: fix tautological-constant-compare compiler warningLuis A. Lozano
This patch fixes the following compiler warning issued by clang: mm-sms-part-cdma.c:301:46: mcomparison 'guint8' (aka 'unsigned char') <= 255 is always true [-Werror,-Wtautological-constant-compare]
2017-08-16charsets: simplify check to see if conversion to charset possibleAleksander Morgado
Instead of having a method that returns the expected length after the conversion and the amount of input UTF-8 characters that couldn't be converted to the given charset, simplify the logic and just define a method that returns a boolean specifying whether the conversion is possible or not. Also, include unit tests.
2017-08-03sms-part-cdma: add missing break statements in cause_code_to_delivery_stateBen Chan
This patch fixes cause_code_to_delivery_state() by adding two missing break statements for the case ERROR_CLASS_TEMPORARY and ERROR_CLASS_PERMANENT in the `switch (error_class)` statement. Without the break statements, the switch always falls through to the default and returns MM_SMS_DELIVERY_STATE_UNKNOWN for an `error_class' of value ERROR_CLASS_TEMPORARY or ERROR_CLASS_PERMANENT.
2014-05-20core: minor coding style fixesBen Chan
2013-10-25sms-part-cdma: fix log messageAleksander Morgado
2013-10-25sms-part-cdma: improve logging when creating PDUsAleksander Morgado
2013-10-25sms-part-cdma: support parsing SMS with Unicode encodingAleksander Morgado
2013-10-25sms-part-cdma: support generating SMS with Latin or Unicode encodingsAleksander Morgado
2013-10-25sms-part-cdma: support receiving SMS with Latin encodingAleksander Morgado
2013-10-25sms-part-cdma: new CDMA SMS creatorAleksander Morgado
Currently very limited: * Only WMT teleservice. * Only DMTF-encoded numbers. * Only either raw binary data or ASCII-7 text.
2013-10-25sms-part-cdma: consolidate loggingAleksander Morgado
2013-10-25sms-part-cdma: read 7-bit ASCII text or raw dataAleksander Morgado
2013-10-25sms-part-cdma: new CDMA SMS parserAleksander Morgado