(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-lldp.c) |
| |
| 2233 | | | dissect_organizational_specific_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 offset) |
| 2234 | | | { |
| 2235 | | | guint16 tempLen; |
| 2236 | | | guint16 tempShort; |
| 2237 | | | guint32 oui; |
| 2238 | | | guint8 subType; |
| 2239 | | | const char *ouiStr; |
| 2240 | | | const char *subTypeStr; |
| 2241 | | | |
| 2242 | | | proto_tree *org_tlv_tree = NULL; |
| 2243 | | | proto_item *tf = NULL; |
| 2244 | | | |
| 2245 | | | |
| 2246 | | | tempShort = tvb_get_ntohs(tvb, offset); |
| 2247 | | | |
| 2248 | | | |
| 2249 | | | tempLen = TLV_INFO_LEN(tempShort); |
| 2250 | | | |
| 2251 | | | |
| 2252 | | | oui = tvb_get_ntoh24(tvb, (offset+2)); |
| 2253 | | | subType = tvb_get_guint8(tvb, (offset+5)); |
| 2254 | | | |
| 2255 | | | ouiStr = val_to_str(oui, tlv_oui_subtype_vals, "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 |
|
| 2256 | | | switch(oui) |
Event 2:
oui evaluates to 4795.
hide
|
|
| 2257 | | | { |
| 2258 | | | case OUI_IEEE_802_1:
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/oui.h |
| |
66 | #define OUI_IEEE_802_1 0x0080C2 /* IEEE 802.1 Committee */ |
| |
|
| 2259 | | | subTypeStr = val_to_str(subType, ieee_802_1_subtypes, "Unknown subtype 0x%x"); |
| 2260 | | | break; |
| 2261 | | | case OUI_IEEE_802_3: |
| 2262 | | | subTypeStr = val_to_str(subType, ieee_802_3_subtypes, "Unknown subtype 0x%x"); |
| 2263 | | | break; |
| 2264 | | | case OUI_MEDIA_ENDPOINT:
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/oui.h |
| |
53 | #define OUI_MEDIA_ENDPOINT 0x0012BB /* Media (TIA TR-41 Committee) */ |
| |
|
| 2265 | | | subTypeStr = val_to_str(subType, media_subtypes, "Unknown subtype 0x%x"); |
| 2266 | | | break; |
| 2267 | | | case OUI_PROFINET:
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/oui.h |
| |
49 | #define OUI_PROFINET 0x000ECF /* PROFIBUS Nutzerorganisation e.V. */ |
| |
|
| 2268 | | | subTypeStr = val_to_str(subType, profinet_subtypes, "Reserved (0x%x)"); |
| 2269 | | | break; |
| 2270 | | | default: |
| 2271 | | | subTypeStr = "Unknown"; |
| 2272 | | | break; |
| 2273 | | | } |
| 2274 | | | |
| 2275 | | | if (tree) |
Event 3:
Skipping " if". tree evaluates to false.
hide
|
|
| 2276 | | | { |
| 2277 | | | tf = proto_tree_add_text(tree, tvb, offset, (tempLen + 2), "%s - %s", |
| 2278 | | | ouiStr, subTypeStr); |
| 2279 | | | org_tlv_tree = proto_item_add_subtree(tf, ett_org_spc_tlv); |
| 2280 | | | |
| 2281 | | | proto_tree_add_item(org_tlv_tree, hf_lldp_tlv_type, tvb, offset, 2, FALSE); |
| 2282 | | | } |
| 2283 | | | if (tempLen < 4) |
Event 4:
Skipping " if". tempLen < 4 evaluates to false.
hide
|
|
| 2284 | | | { |
| 2285 | | | if (tree) |
| 2286 | | | proto_tree_add_uint_format(org_tlv_tree, hf_lldp_tlv_len, tvb, offset, 2, |
| 2287 | | | tempShort, "TLV Length: %u (too short, must be >= 4)", tempLen); |
| 2288 | | | |
| 2289 | | | return (tempLen + 2); |
| 2290 | | | } |
| 2291 | | | if (tree) |
Event 5:
Skipping " if". tree evaluates to false.
hide
|
|
| 2292 | | | { |
| 2293 | | | proto_tree_add_item(org_tlv_tree, hf_lldp_tlv_len, tvb, offset, 2, FALSE); |
| 2294 | | | |
| 2295 | | | |
| 2296 | | | proto_tree_add_uint(org_tlv_tree, hf_org_spc_oui, tvb, (offset+2), 3, oui); |
| 2297 | | | } |
| 2298 | | | |
| 2299 | | | switch (oui) |
Event 6:
oui evaluates to 4795.
hide
|
|
| 2300 | | | { |
| 2301 | | | case OUI_IEEE_802_1:
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/oui.h |
| |
66 | #define OUI_IEEE_802_1 0x0080C2 /* IEEE 802.1 Committee */ |
| |
|
| 2302 | | | dissect_ieee_802_1_tlv(tvb, pinfo, org_tlv_tree, (offset+5)); |
| 2303 | | | break; |
| 2304 | | | case OUI_IEEE_802_3: |
| 2305 | | | dissect_ieee_802_3_tlv(tvb, pinfo, org_tlv_tree, (offset+5)); |
| 2306 | | | break; |
| 2307 | | | case OUI_MEDIA_ENDPOINT:
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/oui.h |
| |
53 | #define OUI_MEDIA_ENDPOINT 0x0012BB /* Media (TIA TR-41 Committee) */ |
| |
|
| 2308 | | | dissect_media_tlv(tvb, pinfo, org_tlv_tree, (offset+5), (guint16) (tempLen-3)); |
| 2309 | | | break; |
| 2310 | | | case OUI_PROFINET:
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/oui.h |
| |
49 | #define OUI_PROFINET 0x000ECF /* PROFIBUS Nutzerorganisation e.V. */ |
| |
|
| 2311 | | | dissect_profinet_tlv(tvb, pinfo, org_tlv_tree, (offset+5), (guint16) (tempLen-3)); |
| 2312 | | | break; |
| 2313 | | | default: |
| 2314 | | | proto_tree_add_item(org_tlv_tree, hf_unknown_subtype, tvb, (offset+5), (guint16) (tempLen-3), FALSE); |
| 2315 | | | } |
| 2316 | | | |
| 2317 | | | return (tempLen + 2); |
| 2318 | | | } |
| |