diff options
author | Dan Williams <dcbw@redhat.com> | 2014-11-21 13:33:32 -0600 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2014-11-21 16:59:10 -0600 |
commit | e80e129be7cbaaca5a77a2fc7d44b16b056d7e4c (patch) | |
tree | c43d0eb2d333ddff32d9b6552971e26c370cfeed /gobi-api/Gobi_2011-11-28-1533/Core/SharedBuffer.cpp | |
parent | ea189aee8af26a7eeaf42a56b9f060d2934bd6cd (diff) | |
download | external_libqmi-e80e129be7cbaaca5a77a2fc7d44b16b056d7e4c.zip external_libqmi-e80e129be7cbaaca5a77a2fc7d44b16b056d7e4c.tar.gz external_libqmi-e80e129be7cbaaca5a77a2fc7d44b16b056d7e4c.tar.bz2 |
qmi-codegen: don't mark missing optional TLVs as set
In the optional TLV case, 'tlv_error' was never set to TRUE
when the optional TLV was missing, because the return value of
qmi_message_tlv_read_init() was ignored. This caused
"self->arg_*_set" to always be TRUE and NULL strings to be
returned to callers requesting the TLV value later.
Also prevent incorrect "Left X bytes unread when getting..."
messages caused when the TLV is missing.
This bug was found when probing a modem that does not return
an MEID TLV to DMSGetIds (because it is GSM/UMTS/LTE only),
but qmi_message_dms_get_ids_output_get_meid() returned TRUE
and a NULL 'str':
if (qmi_message_dms_get_ids_output_get_meid (output, &str, NULL) &&
--> str[0] != '\0' && str[0] != '0') {
Bug introduced in b143b7f6 (qmi-codegen: use the new TLV reader API).
Before:
=======
gsize offset = 0;
gsize init_offset;
gboolean tlv_error = FALSE;
init_offset = qmi_message_tlv_read_init (message, QMI_INDICATION_DMS_EVENT_REPORT_OUTPUT_TLV_POWER_STATE, NULL, NULL);
<<<snip>>>
/* The remaining size of the buffer needs to be 0 if we successfully read the TLV */
if ((offset = __qmi_message_tlv_read_remaining_size (message, init_offset, offset)) > 0) {
g_warning ("Left '%" G_GSIZE_FORMAT "' bytes unread when getting the 'Power State' TLV", offset);
}
qmi_indication_dms_event_report_output_power_state_out:
if (!tlv_error)
self->arg_power_state_set = TRUE;
After:
======
gsize offset = 0;
gsize init_offset;
if ((init_offset = qmi_message_tlv_read_init (message, QMI_INDICATION_DMS_EVENT_REPORT_OUTPUT_TLV_POWER_STATE, NULL, NULL)) == 0) {
goto qmi_indication_dms_event_report_output_power_state_out;
}
<<<snip>>>
/* The remaining size of the buffer needs to be 0 if we successfully read the TLV */
if ((offset = __qmi_message_tlv_read_remaining_size (message, init_offset, offset)) > 0) {
g_warning ("Left '%" G_GSIZE_FORMAT "' bytes unread when getting the 'Power State' TLV", offset);
}
self->arg_power_state_set = TRUE;
qmi_indication_dms_event_report_output_power_state_out:
;
Diffstat (limited to 'gobi-api/Gobi_2011-11-28-1533/Core/SharedBuffer.cpp')
0 files changed, 0 insertions, 0 deletions