diff options
author | Aleksander Morgado <aleksandermj@chromium.org> | 2023-01-16 14:50:33 +0000 |
---|---|---|
committer | Aleksander Morgado <aleksandermj@chromium.org> | 2023-01-16 15:05:21 +0000 |
commit | cf59b497bcdc458742d977fea0c9eed8eba7b824 (patch) | |
tree | 8ac0a465acb54e796e427b473f54bffcf23ed132 | |
parent | 34ba11b3fa6689f8beb7d1c5691607de7aff898d (diff) |
bearer-qmi: app specific info in PCO may be empty
ModemManager[562783]: <err> [1673538458.350130] mm_utils_bin2hexstr: assertion 'bin != NULL' failed
ModemManager[562783]: <dbg> [1673538458.350167] [modem0/bearer0] container ID: 0
ModemManager[562783]: <dbg> [1673538458.350201] [modem0/bearer0] app specific info: (null)
Treat it better by only trying to build the app specific info string
if there are contents in the array.
-rw-r--r-- | src/mm-bearer-qmi.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/mm-bearer-qmi.c b/src/mm-bearer-qmi.c index 5fa38ad3..c69f58cd 100644 --- a/src/mm-bearer-qmi.c +++ b/src/mm-bearer-qmi.c @@ -566,13 +566,22 @@ process_operator_reserved_pco (MMBearerQmi *self, guint8 pco_prefix[9]; gsize pco_raw_len; - if (!qmi_message_wds_get_current_settings_output_get_operator_reserved_pco (output, &tmp_mcc, &tmp_mnc, &mnc_includes_pcs_digit, &array, &container_id, NULL)) - return ; + if (!qmi_message_wds_get_current_settings_output_get_operator_reserved_pco ( + output, + &tmp_mcc, + &tmp_mnc, + &mnc_includes_pcs_digit, + &array, + &container_id, + NULL)) + return; - app_specific_info_str = mm_utils_bin2hexstr ((guint8*) (array->data), array->len); + app_specific_info_str = ((array->len > 0) ? + mm_utils_bin2hexstr ((guint8*) (array->data), array->len) : + NULL); mm_obj_dbg (self, "container ID: %d", container_id); - mm_obj_dbg (self, "app specific info: %s", app_specific_info_str); + mm_obj_dbg (self, "app specific info: %s", app_specific_info_str ? app_specific_info_str : "n/a"); pco_raw_len = sizeof (pco_prefix) + array->len; pco_prefix[0] = 0x27; @@ -610,7 +619,8 @@ process_operator_reserved_pco (MMBearerQmi *self, pco_raw = g_byte_array_sized_new (pco_raw_len); g_byte_array_append (pco_raw, pco_prefix, sizeof (pco_prefix)); - g_byte_array_append (pco_raw, (const guint8 *)array->data, array->len); + if (array->len > 0) + g_byte_array_append (pco_raw, (const guint8 *)array->data, array->len); pco = mm_pco_new (); /* set session ID to 0 (default) */ |