(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-edonkey.c) |
| |
| 3114 | | | static void dissect_edonkey_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) |
| 3115 | | | { |
| 3116 | | | proto_item *ti; |
| 3117 | | | proto_tree *edonkey_tree = NULL, *edonkey_msg_tree = NULL; |
| 3118 | | | int offset; |
| 3119 | | | guint8 protocol, msg_type; |
| 3120 | | | const gchar *protocol_name, *message_name; |
| 3121 | | | |
| 3122 | | | if (check_col(pinfo->cinfo, COL_PROTOCOL)) |
| 3123 | | | col_set_str(pinfo->cinfo, COL_PROTOCOL, "eDonkey"); |
| 3124 | | | |
| 3125 | | | if (check_col(pinfo->cinfo, COL_INFO)) |
| 3126 | | | col_set_str(pinfo->cinfo, COL_INFO, "eDonkey UDP Message"); |
| 3127 | | | |
| 3128 | | | if (tree) { |
| 3129 | | | ti = proto_tree_add_item(tree, proto_edonkey, tvb, 0, -1, FALSE); |
| 3130 | | | edonkey_tree = proto_item_add_subtree(ti, ett_edonkey); |
| 3131 | | | } |
| 3132 | | | |
| 3133 | | | offset = 0; |
| 3134 | | | |
| 3135 | | | if (tvb_length_remaining(tvb, offset) >= ) { |
| 3136 | | | protocol = tvb_get_guint8(tvb, offset); |
| 3137 | | | msg_type = tvb_get_guint8(tvb, offset+1); |
| 3138 | | | protocol_name = val_to_str(protocol, edonkey_protocols, "Unknown"); |
| 3139 | | | |
| 3140 | | | if (protocol == EDONKEY_PROTO_KADEMLIA || protocol == EDONKEY_PROTO_KADEMLIA_COMP |
| 3141 | | | || protocol == EDONKEY_PROTO_ADU_KADEMLIA || protocol == EDONKEY_PROTO_ADU_KADEMLIA_COMP) |
| 3142 | | | message_name = val_to_str( msg_type, kademlia_msgs, "Unknown"); |
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 |
|
| 3143 | | | else |
| 3144 | | | message_name = val_to_str(msg_type, edonkey_udp_msgs, "Unknown"); |
| 3145 | | | |
| 3146 | | | if (check_col(pinfo->cinfo, COL_INFO)) { |
Event 2:
Skipping " if". check_col(...) evaluates to false.
hide
|
|
| 3147 | | | col_add_fstr(pinfo->cinfo, COL_INFO, "%s UDP: %s", protocol_name, message_name); |
| 3148 | | | } |
| 3149 | | | |
| 3150 | | | if (edonkey_tree) { |
Event 3:
Skipping " if". edonkey_tree evaluates to false.
hide
|
|
| 3151 | | | int remainingLength, ; |
| 3152 | | | |
| 3153 | | | ti = proto_tree_add_item(edonkey_tree, hf_edonkey_message, tvb, offset, -1, FALSE); |
| 3154 | | | edonkey_msg_tree = proto_item_add_subtree(ti, ett_edonkey_message); |
| 3155 | | | |
| 3156 | | | proto_tree_add_uint_format(edonkey_msg_tree, hf_edonkey_protocol, tvb, offset, 1, protocol, |
| 3157 | | | "Protocol: %s (0x%02x)", protocol_name, protocol); |
| 3158 | | | proto_tree_add_uint_format(edonkey_msg_tree, hf_edonkey_message_type, tvb, offset+1, 1, msg_type, |
| 3159 | | | "Message Type: %s (0x%02x)", message_name, msg_type); |
| 3160 | | | |
| 3161 | | | offset += ; |
| 3162 | | | remainingLength = tvb_length_remaining( tvb, offset ); |
| 3163 | | | |
| 3164 | | | switch (protocol) { |
| 3165 | | | case EDONKEY_PROTO_EDONKEY: |
| 3166 | | | offset = dissect_edonkey_udp_message(msg_type, tvb, pinfo, offset, remainingLength, edonkey_msg_tree); |
| 3167 | | | break; |
| 3168 | | | |
| 3169 | | | case EDONKEY_PROTO_EMULE_EXT: |
| 3170 | | | offset = dissect_emule_udp_message(msg_type, tvb, pinfo, offset, remainingLength, edonkey_msg_tree); |
| 3171 | | | break; |
| 3172 | | | |
| 3173 | | | case EDONKEY_PROTO_ADU_KADEMLIA: |
| 3174 | | | case EDONKEY_PROTO_KADEMLIA: |
| 3175 | | | offset = dissect_kademlia_udp_message(msg_type, tvb, pinfo, offset, remainingLength, edonkey_msg_tree); |
| 3176 | | | break; |
| 3177 | | | |
| 3178 | | | case EDONKEY_PROTO_ADU_KADEMLIA_COMP: |
| 3179 | | | case EDONKEY_PROTO_KADEMLIA_COMP: |
| 3180 | | | offset = dissect_kademlia_udp_compressed_message(msg_type, tvb, pinfo, offset, remainingLength, edonkey_msg_tree); |
| 3181 | | | break; |
| 3182 | | | |
| 3183 | | | default: |
| 3184 | | | break; |
| 3185 | | | } |
| 3186 | | | |
| 3187 | | | = tvb_length_remaining( tvb, offset ); |
| 3188 | | | |
| 3189 | | | if ( > 0 ) { |
| 3190 | | | |
| 3191 | | | proto_tree_add_uint_format(tree, hf_edonkey_unparsed_data_length, tvb, offset, , , |
| 3192 | | | "Trailing/Undecoded data: %d bytes", ); |
| 3193 | | | } |
| 3194 | | | } |
| 3195 | | | } |
| 3196 | | | } |
| |