(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-armagetronad.c) |
| |
| 181 | | | add_message(tvbuff_t * tvb, gint offset, proto_tree * tree, GString * info) |
| 182 | | | { |
| 183 | | | guint16 descriptor_id, message_id; |
| 184 | | | gint data_len; |
| 185 | | | proto_item *msg; |
| 186 | | | proto_tree *msg_tree; |
| 187 | | | const gchar *descriptor; |
| 188 | | | |
| 189 | | | descriptor_id = tvb_get_ntohs(tvb, offset); |
| 190 | | | message_id = tvb_get_ntohs(tvb, offset + 2); |
| 191 | | | data_len = tvb_get_ntohs(tvb, offset + 4) * 2; |
| 192 | | | |
| 193 | | | |
| 194 | | | descriptor = val_to_str(descriptor_id, descriptors, "Unknown (%u)"); |
Ignored Return Value
The return value of val_to_str() 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 val_to_str() is checked 98% 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 val_to_str() from the Ignored Return Value check, use configuration file parameter RETURN_CHECKER_IGNORED_FUNCS).
Show: All events | Only primary events |
|
| 195 | | | if (descriptor_id == ACK) |
Event 2:
Taking true branch. descriptor_id == 1 evaluates to true.
hide
|
|
| 196 | | | msg = proto_tree_add_none_format(tree, |
| 197 | | | hf_armagetronad_msg_subtree, |
| 198 | | | tvb, offset, data_len + 6, |
| 199 | | | "ACK %d messages", |
| 200 | | | data_len / 2); |
| 201 | | | else |
| 202 | | | msg = proto_tree_add_none_format(tree, |
| 203 | | | hf_armagetronad_msg_subtree, |
| 204 | | | tvb, offset, data_len + 6, |
| 205 | | | "Message 0x%04x [%s]", |
| 206 | | | message_id, descriptor); |
| 207 | | | |
| 208 | | | msg_tree = proto_item_add_subtree(msg, ett_message); |
| 209 | | | |
| 210 | | | |
| 211 | | | proto_tree_add_item(msg_tree, hf_armagetronad_descriptor_id, tvb, |
| 212 | | | offset, 2, FALSE); |
| 213 | | | if (info) |
Event 3:
Skipping " if". info evaluates to false.
hide
|
|
| 214 | | | g_string_append_printf(info, "%s, ", descriptor); |
| 215 | | | |
| 216 | | | |
| 217 | | | proto_tree_add_item(msg_tree, hf_armagetronad_message_id, tvb, |
| 218 | | | offset + 2, 2, FALSE); |
| 219 | | | |
| 220 | | | |
| 221 | | | proto_tree_add_item(msg_tree, hf_armagetronad_data_len, tvb, |
| 222 | | | offset + 4, 2, FALSE); |
| 223 | | | |
| 224 | | | |
| 225 | | | add_message_data(tvb, offset + 6, data_len, msg_tree); |
| 226 | | | |
| 227 | | | return data_len + 6; |
| 228 | | | } |
| |