(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-acse.c) |
| |
| 1655 | | | dissect_acse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) |
| 1656 | | | { |
| 1657 | | | int offset = 0; |
| 1658 | | | proto_item *item=NULL; |
| 1659 | | | proto_tree *tree=NULL; |
| 1660 | | | char *oid; |
| 1661 | | | asn1_ctx_t asn1_ctx; |
| 1662 | | | asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); |
| 1663 | | | |
| 1664 | | | |
| 1665 | | | |
| 1666 | | | |
| 1667 | | | if (!tvb_bytes_exist(tvb, 0, 2)){ |
| 1668 | | | proto_tree_add_text(parent_tree, tvb, offset, |
| 1669 | | | tvb_reported_length_remaining(tvb,offset), |
| 1670 | | | "User data"); |
| 1671 | | | return; |
| 1672 | | | } |
| 1673 | | | |
| 1674 | | | if( !pinfo->private_data ){ |
| 1675 | | | if(parent_tree){ |
| 1676 | | | REPORT_DISSECTOR_BUG("Can't get SPDU type from session dissector.");
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
106 | #define REPORT_DISSECTOR_BUG(message) \ |
107 | ((getenv("WIRESHARK_ABORT_ON_DISSECTOR_BUG") != NULL) ? \ |
108 | abort() : \ |
109 | THROW_MESSAGE(DissectorError, message)) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/exceptions.h |
| |
226 | #define THROW_MESSAGE(x, y) \ |
227 | except_throw(XCEPT_GROUP_WIRESHARK, (x), (y)) |
| |
|
| 1677 | | | } |
| 1678 | | | return ; |
| 1679 | | | } else { |
| 1680 | | | session = ( (struct SESSION_DATA_STRUCTURE*)(pinfo->private_data) ); |
| 1681 | | | if(session->spdu_type == 0 ) { |
| 1682 | | | if(parent_tree){ |
| 1683 | | | REPORT_DISSECTOR_BUG(
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
106 | #define REPORT_DISSECTOR_BUG(message) \ |
107 | ((getenv("WIRESHARK_ABORT_ON_DISSECTOR_BUG") != NULL) ? \ |
108 | abort() : \ |
109 | THROW_MESSAGE(DissectorError, message)) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/exceptions.h |
| |
226 | #define THROW_MESSAGE(x, y) \ |
227 | except_throw(XCEPT_GROUP_WIRESHARK, (x), (y)) |
| |
|
| 1684 | | | ep_strdup_printf("Wrong spdu type %x from session dissector.",session->spdu_type)); |
| 1685 | | | return ; |
Unreachable Control Flow
The highlighted code will not execute under any circumstances. This may be because of: |
|
| 1686 | | | } |
| 1687 | | | } |
| 1688 | | | } |
| 1689 | | | |
| 1690 | | | top_tree=parent_tree; |
| 1691 | | | |
| 1692 | | | |
| 1693 | | | |
| 1694 | | | |
| 1695 | | | switch(session->spdu_type){ |
| 1696 | | | case SES_CONNECTION_REQUEST: |
| 1697 | | | case SES_CONNECTION_ACCEPT: |
| 1698 | | | case SES_REFUSE: |
| 1699 | | | case SES_DISCONNECT: |
| 1700 | | | case SES_FINISH: |
| 1701 | | | case SES_ABORT: |
| 1702 | | | break; |
| 1703 | | | case SES_DATA_TRANSFER: |
| 1704 | | | oid=find_oid_by_pres_ctx_id(pinfo, indir_ref); |
| 1705 | | | if(oid){ |
| 1706 | | | if(strcmp(oid, ACSE_APDU_OID) == 0){ |
| 1707 | | | proto_tree_add_text(parent_tree, tvb, offset, -1, |
| 1708 | | | "Invalid OID: %s", ACSE_APDU_OID); |
| 1709 | | | THROW(ReportedBoundsError);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/exceptions.h |
| |
223 | #define THROW(x) \ |
224 | except_throw(XCEPT_GROUP_WIRESHARK, (x), NULL) |
| |
|
| 1710 | | | } |
| 1711 | | | call_ber_oid_callback(oid, tvb, offset, pinfo, parent_tree); |
| 1712 | | | } else { |
| 1713 | | | proto_item *ti = proto_tree_add_text(parent_tree, tvb, offset, -1, "dissector is not available"); |
| 1714 | | | expert_add_info_format(pinfo, ti, PI_UNDECODED, PI_WARN, "Dissector is not available"); |
| 1715 | | | } |
| 1716 | | | top_tree = NULL; |
| 1717 | | | return; |
| 1718 | | | default: |
| 1719 | | | top_tree = NULL; |
| 1720 | | | return; |
| 1721 | | | } |
| 1722 | | | |
| 1723 | | | |
| 1724 | | | if(parent_tree){ |
| 1725 | | | item = proto_tree_add_item(parent_tree, proto_acse, tvb, 0, -1, FALSE); |
| 1726 | | | tree = proto_item_add_subtree(item, ett_acse); |
| 1727 | | | } |
| 1728 | | | if (check_col(pinfo->cinfo, COL_PROTOCOL)) |
| 1729 | | | col_set_str(pinfo->cinfo, COL_PROTOCOL, "ACSE"); |
| 1730 | | | if (check_col(pinfo->cinfo, COL_INFO)) |
| 1731 | | | col_clear(pinfo->cinfo, COL_INFO); |
| 1732 | | | |
| 1733 | | | |
| 1734 | | | |
| 1735 | | | |
| 1736 | | | while (tvb_reported_length_remaining(tvb, offset) > 0){ |
| 1737 | | | int old_offset=offset; |
| 1738 | | | offset = dissect_acse_ACSE_apdu(FALSE, tvb, offset, &asn1_ctx, tree, -1); |
| 1739 | | | if(offset == old_offset ){ |
| 1740 | | | proto_tree_add_text(tree, tvb, offset, -1,"Malformed packet"); |
| 1741 | | | offset = tvb_length(tvb); |
| 1742 | | | break; |
| 1743 | | | } |
| 1744 | | | } |
| 1745 | | | |
| 1746 | | | top_tree = NULL; |
| 1747 | | | } |
| |