(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-ppp.c) |
| |
| 1511 | | | tvbuff_t * |
| 1512 | | | decode_fcs(tvbuff_t *tvb, proto_tree *fh_tree, int fcs_decode, int proto_offset) |
| 1513 | | | { |
| 1514 | | | tvbuff_t *next_tvb; |
| 1515 | | | gint len, reported_len; |
| 1516 | | | int rx_fcs_offset; |
| 1517 | | | guint32 rx_fcs_exp; |
| 1518 | | | guint32 rx_fcs_got; |
| 1519 | | | |
| 1520 | | | |
| 1521 | | | |
| 1522 | | | |
| 1523 | | | switch (fcs_decode) { |
| 1524 | | | |
| 1525 | | | case NO_FCS: |
| 1526 | | | next_tvb = tvb_new_subset(tvb, proto_offset, -1, -1); |
| 1527 | | | break; |
| 1528 | | | |
| 1529 | | | case FCS_16: |
| 1530 | | | |
| 1531 | | | |
| 1532 | | | |
| 1533 | | | len = tvb_length_remaining(tvb, proto_offset); |
| 1534 | | | reported_len = tvb_reported_length_remaining(tvb, proto_offset); |
| 1535 | | | if (reported_len < 2 || len < 0) { |
| 1536 | | | |
| 1537 | | | |
| 1538 | | | |
| 1539 | | | |
| 1540 | | | |
| 1541 | | | next_tvb = tvb_new_subset(tvb, proto_offset, -1, -1); |
| 1542 | | | } else if (len < reported_len) { |
| 1543 | | | |
| 1544 | | | |
| 1545 | | | |
| 1546 | | | |
| 1547 | | | |
| 1548 | | | |
| 1549 | | | |
| 1550 | | | |
| 1551 | | | reported_len -= 2; |
| 1552 | | | if (len > reported_len) |
| 1553 | | | len = reported_len; |
| 1554 | | | next_tvb = tvb_new_subset(tvb, proto_offset, len, reported_len); |
| 1555 | | | } else { |
| 1556 | | | |
| 1557 | | | |
| 1558 | | | |
| 1559 | | | |
| 1560 | | | len -= 2; |
| 1561 | | | reported_len -= 2; |
| 1562 | | | next_tvb = tvb_new_subset(tvb, proto_offset, len, reported_len); |
| 1563 | | | |
| 1564 | | | |
| 1565 | | | |
| 1566 | | | |
| 1567 | | | rx_fcs_offset = proto_offset + len; |
| 1568 | | | rx_fcs_exp = fcs16(tvb); |
| 1569 | | | rx_fcs_got = tvb_get_letohs(tvb, rx_fcs_offset); |
| 1570 | | | if (rx_fcs_got != rx_fcs_exp) { |
| 1571 | | | proto_tree_add_text(fh_tree, tvb, rx_fcs_offset, 2, |
| 1572 | | | "FCS 16: 0x%04x [incorrect, should be 0x%04x]", |
| 1573 | | | rx_fcs_got, rx_fcs_exp); |
| 1574 | | | } else { |
| 1575 | | | proto_tree_add_text(fh_tree, tvb, rx_fcs_offset, 2, |
| 1576 | | | "FCS 16: 0x%04x [correct]", |
| 1577 | | | rx_fcs_got); |
| 1578 | | | } |
| 1579 | | | } |
| 1580 | | | break; |
| 1581 | | | |
| 1582 | | | case FCS_32: |
| 1583 | | | |
| 1584 | | | |
| 1585 | | | |
| 1586 | | | len = tvb_length_remaining(tvb, proto_offset); |
| 1587 | | | reported_len = tvb_reported_length_remaining(tvb, proto_offset); |
| 1588 | | | if (reported_len < 4) { |
| 1589 | | | |
| 1590 | | | |
| 1591 | | | |
| 1592 | | | |
| 1593 | | | next_tvb = tvb_new_subset(tvb, proto_offset, -1, -1); |
| 1594 | | | } else if (len < reported_len) { |
| 1595 | | | |
| 1596 | | | |
| 1597 | | | |
| 1598 | | | |
| 1599 | | | |
| 1600 | | | |
| 1601 | | | |
| 1602 | | | |
| 1603 | | | reported_len -= 4; |
| 1604 | | | if (len > reported_len) |
| 1605 | | | len = reported_len; |
| 1606 | | | next_tvb = tvb_new_subset(tvb, proto_offset, len, reported_len); |
| 1607 | | | } else { |
| 1608 | | | |
| 1609 | | | |
| 1610 | | | |
| 1611 | | | |
| 1612 | | | len -= 4; |
| 1613 | | | reported_len -= 4; |
| 1614 | | | next_tvb = tvb_new_subset(tvb, proto_offset, len, reported_len); |
| 1615 | | | |
| 1616 | | | |
| 1617 | | | |
| 1618 | | | |
| 1619 | | | rx_fcs_offset = proto_offset + len; |
| 1620 | | | rx_fcs_exp = fcs32(tvb); |
| 1621 | | | rx_fcs_got = tvb_get_letohl(tvb, rx_fcs_offset); |
| 1622 | | | if (rx_fcs_got != rx_fcs_exp) { |
| 1623 | | | proto_tree_add_text(fh_tree, tvb, rx_fcs_offset, 4, |
| 1624 | | | "FCS 32: 0x%08x [incorrect, should be 0x%08x]", |
| 1625 | | | rx_fcs_got, rx_fcs_exp); |
| 1626 | | | } else { |
| 1627 | | | proto_tree_add_text(fh_tree, tvb, rx_fcs_offset, 4, |
| 1628 | | | "FCS 32: 0x%08x [correct]", |
| 1629 | | | rx_fcs_got); |
| 1630 | | | } |
| 1631 | | | } |
| 1632 | | | break; |
| 1633 | | | |
| 1634 | | | default: |
| 1635 | | | DISSECTOR_ASSERT_NOT_REACHED();
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
131 | #define DISSECTOR_ASSERT_NOT_REACHED() \ |
132 | (REPORT_DISSECTOR_BUG( \ |
133 | ep_strdup_printf("%s:%u: failed assertion \"DISSECTOR_ASSERT_NOT_REACHED\"", \ |
134 | __FILE__, __LINE__))) |
| |
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)) |
| |
|
| 1636 | | | next_tvb = NULL; |
Unreachable Computation
The highlighted code will not execute under any circumstances. This may be because of: |
|
| 1637 | | | } |
| 1638 | | | |
| 1639 | | | return next_tvb; |
| 1640 | | | } |
| |