(/home/sate/Testcases/c/cve/wireshark-1.2.0/plugins/wimax/msg_res_cmd.c) |
| |
| 99 | | | void dissect_mac_mgmt_msg_res_cmd_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) |
| 100 | | | { |
| 101 | | | guint offset = 0; |
| 102 | | | guint tvb_len, payload_type; |
| 103 | | | gint tlv_type, tlv_len, tlv_value_offset; |
| 104 | | | proto_item *res_cmd_item = NULL; |
| 105 | | | proto_tree *res_cmd_tree = NULL; |
| 106 | | | proto_tree *tlv_tree = NULL; |
| 107 | | | tlv_info_t tlv_info; |
| 108 | | | |
| 109 | | | |
| 110 | | | payload_type = tvb_get_guint8(tvb, offset); |
| 111 | | | if(payload_type != MAC_MGMT_MSG_RES_CMD) |
| 112 | | | { |
| 113 | | | return; |
| 114 | | | } |
| 115 | | | |
| 116 | | | if(tree) |
| 117 | | | { |
| 118 | | | |
| 119 | | | tvb_len = tvb_reported_length(tvb); |
| 120 | | | |
| 121 | | | res_cmd_item = proto_tree_add_protocol_format(tree, proto_mac_mgmt_msg_res_cmd_decoder, tvb, offset, tvb_len, "Reset Command (RES-CMD) (%u bytes)", tvb_len); |
| 122 | | | |
| 123 | | | res_cmd_tree = proto_item_add_subtree(res_cmd_item, ett_mac_mgmt_msg_res_cmd_decoder); |
| 124 | | | |
| 125 | | | |
| 126 | | | proto_tree_add_item(res_cmd_tree, hf_res_cmd_message_type, tvb, offset, 1, FALSE); |
| 127 | | | |
| 128 | | | offset++; |
| 129 | | | |
| 130 | | | while(offset < tvb_len) |
Event 2:
Continuing from loop body. Leaving loop. offset < tvb_len evaluates to false.
hide
|
|
| 131 | | | { |
| 132 | | | |
| 133 | | | init_tlv_info(&tlv_info, tvb, offset); |
| 134 | | | |
| 135 | | | tlv_type = get_tlv_type(&tlv_info); |
| 136 | | | |
| 137 | | | tlv_len = get_tlv_length(&tlv_info); |
| 138 | | | if(tlv_type == -1 || tlv_len > MAX_TLV_LEN || tlv_len < 1) |
| 139 | | | { |
| 140 | | | if(check_col(pinfo->cinfo, COL_INFO)) |
| 141 | | | { |
| 142 | | | col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, "RES-CMD TLV error"); |
| 143 | | | } |
| 144 | | | proto_tree_add_item(res_cmd_tree, hf_res_cmd_invalid_tlv, tvb, offset, (tvb_len - offset), FALSE); |
| 145 | | | break; |
| 146 | | | } |
| 147 | | | |
| 148 | | | tlv_value_offset = get_tlv_value_offset(&tlv_info); |
| 149 | | | #ifdef DEBUG |
| 150 | | | proto_tree_add_protocol_format(res_cmd_tree, proto_mac_mgmt_msg_res_cmd_decoder, tvb, offset, (tlv_len + tlv_value_offset), "RES-CMD Type: %u (%u bytes, offset=%u, tlv_len=%u, tvb_len=%u)", tlv_type, (tlv_len + tlv_value_offset), offset, tlv_len, tvb_len); |
| 151 | | | #endif |
| 152 | | | |
| 153 | | | offset += tlv_value_offset; |
| 154 | | | |
| 155 | | | switch (tlv_type) |
| 156 | | | { |
| 157 | | | case HMAC_TUPLE: |
| 158 | | | |
| 159 | | | tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_res_cmd_decoder, res_cmd_tree, proto_mac_mgmt_msg_res_cmd_decoder, tvb, offset, tlv_len, "HMAC Tuple (%u byte(s))", tlv_len); |
| 160 | | | wimax_hmac_tuple_decoder(tlv_tree, tvb, offset, tlv_len); |
| 161 | | | break; |
| 162 | | | case CMAC_TUPLE: |
| 163 | | | |
| 164 | | | tlv_tree = add_protocol_subtree(&tlv_info, ett_mac_mgmt_msg_res_cmd_decoder, res_cmd_tree, proto_mac_mgmt_msg_res_cmd_decoder, tvb, offset, tlv_len, "CMAC Tuple (%u byte(s))", tlv_len); |
| 165 | | | wimax_cmac_tuple_decoder(tlv_tree, tvb, offset, tlv_len); |
| 166 | | | break; |
| 167 | | | default: |
| 168 | | | |
| 169 | | | tlv_tree = add_tlv_subtree(&tlv_info, ett_mac_mgmt_msg_res_cmd_decoder, res_cmd_tree, hf_res_cmd_unknown_type, tvb, offset, tlv_len, FALSE); |
Ignored Return Value
The return value of add_tlv_subtree() is never checked in the highlighted execution scenario. - If the return value can indicate an error, the error will be ignored if the highlighted code executes.
- The return value of add_tlv_subtree() is checked 99% of the time in this project. CodeSonar is configured to enforce Ignored Return Value checks for any function whose return value is checked at least 96% of the time, unless the function is used fewer than 20 times. (To modify these thresholds, use configuration file parameters RETURN_CHECKER_SAMPLE_SIZE and RETURN_CHECKER_RATIO. To exempt add_tlv_subtree() from the Ignored Return Value check, use configuration file parameter RETURN_CHECKER_IGNORED_FUNCS).
Show: All events | Only primary events |
|
| 170 | | | proto_tree_add_item(res_cmd_tree, hf_res_cmd_unknown_type, tvb, offset, tlv_len, FALSE); |
| 171 | | | break; |
| 172 | | | } |
| 173 | | | offset += tlv_len; |
| 174 | | | } |
| 175 | | | } |
| 176 | | | } |
| |