(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-bgp.c) |
| |
| 2713 | | | dissect_bgp_pdu(tvbuff_t *volatile tvb, packet_info *pinfo, proto_tree *tree, |
| 2714 | | | gboolean first) |
| 2715 | | | { |
| 2716 | | | guint16 bgp_len; |
| 2717 | | | guint8 bgp_type; |
| 2718 | | | const char *typ; |
| 2719 | | | proto_item *ti; |
| 2720 | | | proto_tree *bgp_tree; |
| 2721 | | | proto_tree *bgp1_tree; |
| 2722 | | | |
| 2723 | | | bgp_len = tvb_get_ntohs(tvb, BGP_MARKER_SIZE); |
| 2724 | | | bgp_type = tvb_get_guint8(tvb, BGP_MARKER_SIZE + 2); |
| 2725 | | | typ = val_to_str(bgp_type, bgptypevals, "Unknown message type (0x%02x)"); |
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 |
|
| 2726 | | | |
| 2727 | | | if (check_col(pinfo->cinfo, COL_INFO)) { |
Event 2:
Skipping " if". check_col(...) evaluates to false.
hide
|
|
| 2728 | | | if (first) |
| 2729 | | | col_add_str(pinfo->cinfo, COL_INFO, typ); |
| 2730 | | | else |
| 2731 | | | col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", typ); |
| 2732 | | | } |
| 2733 | | | |
| 2734 | | | if (tree) { |
Event 3:
Skipping " if". tree evaluates to false.
hide
|
|
| 2735 | | | ti = proto_tree_add_item(tree, proto_bgp, tvb, 0, -1, FALSE); |
| 2736 | | | bgp_tree = proto_item_add_subtree(ti, ett_bgp); |
| 2737 | | | |
| 2738 | | | ti = proto_tree_add_text(bgp_tree, tvb, 0, -1, "%s", typ); |
| 2739 | | | |
| 2740 | | | |
| 2741 | | | switch (bgp_type) { |
| 2742 | | | case BGP_OPEN: |
| 2743 | | | bgp1_tree = proto_item_add_subtree(ti, ett_bgp_open); |
| 2744 | | | break; |
| 2745 | | | case BGP_UPDATE: |
| 2746 | | | bgp1_tree = proto_item_add_subtree(ti, ett_bgp_update); |
| 2747 | | | break; |
| 2748 | | | case BGP_NOTIFICATION: |
| 2749 | | | bgp1_tree = proto_item_add_subtree(ti, ett_bgp_notification); |
| 2750 | | | break; |
| 2751 | | | case BGP_KEEPALIVE: |
| 2752 | | | bgp1_tree = proto_item_add_subtree(ti, ett_bgp); |
| 2753 | | | break; |
| 2754 | | | case BGP_ROUTE_REFRESH_CISCO: |
| 2755 | | | case BGP_ROUTE_REFRESH: |
| 2756 | | | bgp1_tree = proto_item_add_subtree(ti, ett_bgp_route_refresh); |
| 2757 | | | break; |
| 2758 | | | case BGP_CAPABILITY: |
| 2759 | | | bgp1_tree = proto_item_add_subtree(ti, ett_bgp_capability); |
| 2760 | | | break; |
| 2761 | | | default: |
| 2762 | | | bgp1_tree = proto_item_add_subtree(ti, ett_bgp); |
| 2763 | | | break; |
| 2764 | | | } |
| 2765 | | | |
| 2766 | | | proto_tree_add_text(bgp1_tree, tvb, 0, BGP_MARKER_SIZE, |
| 2767 | | | "Marker: 16 bytes"); |
| 2768 | | | |
| 2769 | | | if (bgp_len < || bgp_len > BGP_MAX_PACKET_SIZE) { |
| 2770 | | | proto_tree_add_text(bgp1_tree, tvb, BGP_MARKER_SIZE, 2, |
| 2771 | | | "Length (invalid): %u byte%s", bgp_len, |
| 2772 | | | plurality(bgp_len, "", "s")); |
| 2773 | | | return; |
| 2774 | | | } else { |
| 2775 | | | proto_tree_add_text(bgp1_tree, tvb, BGP_MARKER_SIZE, 2, |
| 2776 | | | "Length: %u byte%s", bgp_len, |
| 2777 | | | plurality(bgp_len, "", "s")); |
| 2778 | | | } |
| 2779 | | | |
| 2780 | | | proto_tree_add_uint(bgp1_tree, hf_bgp_type, tvb, |
| 2781 | | | BGP_MARKER_SIZE + 2, 1, |
| 2782 | | | bgp_type); |
| 2783 | | | |
| 2784 | | | switch (bgp_type) { |
| 2785 | | | case BGP_OPEN: |
| 2786 | | | dissect_bgp_open(tvb, bgp1_tree); |
| 2787 | | | break; |
| 2788 | | | case BGP_UPDATE: |
| 2789 | | | dissect_bgp_update(tvb, bgp1_tree); |
| 2790 | | | break; |
| 2791 | | | case BGP_NOTIFICATION: |
| 2792 | | | dissect_bgp_notification(tvb, bgp1_tree); |
| 2793 | | | break; |
| 2794 | | | case BGP_KEEPALIVE: |
| 2795 | | | |
| 2796 | | | break; |
| 2797 | | | case BGP_ROUTE_REFRESH_CISCO: |
| 2798 | | | case BGP_ROUTE_REFRESH: |
| 2799 | | | dissect_bgp_route_refresh(tvb, bgp1_tree); |
| 2800 | | | break; |
| 2801 | | | case BGP_CAPABILITY: |
| 2802 | | | dissect_bgp_capability(tvb, bgp1_tree); |
| 2803 | | | break; |
| 2804 | | | default: |
| 2805 | | | break; |
| 2806 | | | } |
| 2807 | | | } |
| 2808 | | | } |
| |