(/home/sate/Testcases/c/cve/wireshark-1.2.0/file.c) |
| |
| 1498 | | | rescan_packets(capture_file *cf, const char *action, const char *action_item, |
| 1499 | | | gboolean refilter, gboolean redissect) |
| 1500 | | | { |
| 1501 | | | frame_data *fdata; |
| 1502 | | | progdlg_t *progbar = NULL; |
| 1503 | | | gboolean stop_flag; |
| 1504 | | | int count; |
| 1505 | | | int err; |
| 1506 | | | gchar *err_info; |
| 1507 | | | frame_data *selected_frame, *preceding_frame, *following_frame, *prev_frame; |
| 1508 | | | int selected_row, prev_row, preceding_row, following_row; |
| 1509 | | | gboolean selected_frame_seen; |
| 1510 | | | int row; |
| 1511 | | | float progbar_val; |
| 1512 | | | GTimeVal start_time; |
| 1513 | | | gchar status_str[100]; |
| 1514 | | | int progbar_nextstep; |
| 1515 | | | int progbar_quantum; |
| 1516 | | | dfilter_t *dfcode; |
| 1517 | | | |
| 1518 | | | |
| 1519 | | | |
| 1520 | | | |
| 1521 | | | |
| 1522 | | | dfcode=NULL; |
| 1523 | | | if(cf->dfilter){ |
| 1524 | | | dfilter_compile(cf->dfilter, &dfcode); |
| 1525 | | | } |
| 1526 | | | |
| 1527 | | | cum_bytes=0; |
| 1528 | | | reset_tap_listeners(); |
| 1529 | | | |
| 1530 | | | |
| 1531 | | | |
| 1532 | | | |
| 1533 | | | selected_frame = cf->current_frame; |
| 1534 | | | |
| 1535 | | | |
| 1536 | | | |
| 1537 | | | selected_row = -1; |
| 1538 | | | |
| 1539 | | | if (redissect) { |
| 1540 | | | |
| 1541 | | | |
| 1542 | | | |
| 1543 | | | |
| 1544 | | | |
| 1545 | | | |
| 1546 | | | |
| 1547 | | | cf->redissecting = TRUE; |
| 1548 | | | |
| 1549 | | | |
| 1550 | | | init_dissection(); |
| 1551 | | | } |
| 1552 | | | |
| 1553 | | | |
| 1554 | | | |
| 1555 | | | packet_list_freeze(); |
| 1556 | | | |
| 1557 | | | |
| 1558 | | | packet_list_clear(); |
| 1559 | | | |
| 1560 | | | |
| 1561 | | | cf->first_displayed = NULL; |
| 1562 | | | cf->last_displayed = NULL; |
| 1563 | | | |
| 1564 | | | |
| 1565 | | | cf->displayed_count = 0; |
| 1566 | | | |
| 1567 | | | |
| 1568 | | | |
| 1569 | | | |
| 1570 | | | nstime_set_unset(&first_ts); |
| 1571 | | | nstime_set_unset(&prev_dis_ts); |
| 1572 | | | |
| 1573 | | | |
| 1574 | | | progbar_nextstep = 0; |
| 1575 | | | |
| 1576 | | | |
| 1577 | | | progbar_quantum = cf->count/N_PROGBAR_UPDATES; |
| 1578 | | | |
| 1579 | | | count = 0; |
| 1580 | | | |
| 1581 | | | progbar_val = 0.0f; |
| 1582 | | | |
| 1583 | | | stop_flag = FALSE; |
| 1584 | | | g_get_current_time(&start_time); |
| 1585 | | | |
| 1586 | | | row = -1; |
| 1587 | | | prev_row = -1; |
| 1588 | | | prev_frame = NULL; |
| 1589 | | | |
| 1590 | | | preceding_row = -1; |
| 1591 | | | preceding_frame = NULL; |
| 1592 | | | following_row = -1; |
| 1593 | | | following_frame = NULL; |
| 1594 | | | |
| 1595 | | | selected_frame_seen = FALSE; |
| 1596 | | | |
| 1597 | | | for (fdata = cf->plist; fdata != NULL; fdata = fdata->next) { |
| 1598 | | | |
| 1599 | | | |
| 1600 | | | |
| 1601 | | | |
| 1602 | | | |
| 1603 | | | if (progbar == NULL) |
| 1604 | | | progbar = delayed_create_progress_dlg(action, action_item, TRUE, |
| 1605 | | | &stop_flag, &start_time, |
| 1606 | | | progbar_val); |
| 1607 | | | |
| 1608 | | | |
| 1609 | | | |
| 1610 | | | |
| 1611 | | | |
| 1612 | | | |
| 1613 | | | if (count >= progbar_nextstep) { |
| 1614 | | | |
| 1615 | | | |
| 1616 | | | |
| 1617 | | | g_assert(cf->count > 0);
x /usr/include/glib-2.0/glib/gtestutils.h |
| |
74 | #define g_assert(expr) do { if G_LIKELY (expr) ; else \ |
75 | g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ |
76 | #expr); } while (0) |
| |
x /usr/include/glib-2.0/glib/gmacros.h |
| |
277 | #define G_LIKELY(expr) (__builtin_expect (_G_BOOLEAN_EXPR(expr), 1)) |
| |
x /usr/include/glib-2.0/glib/gmacros.h |
| |
268 | #define _G_BOOLEAN_EXPR(expr) \ |
269 | __extension__ ({ \ |
270 | int _g_boolean_var_; \ |
271 | if (expr) \ |
272 | _g_boolean_var_ = 1; \ |
273 | else \ |
274 | _g_boolean_var_ = 0; \ |
275 | _g_boolean_var_; \ |
276 | }) |
| |
x /usr/include/glib-2.0/glib/gmacros.h |
| |
160 | # define G_STRFUNC ((const char*) (__PRETTY_FUNCTION__)) |
| |
|
| 1618 | | | progbar_val = (gfloat) count / cf->count; |
| 1619 | | | |
| 1620 | | | if (progbar != NULL) { |
| 1621 | | | g_snprintf(status_str, sizeof(status_str), |
| 1622 | | | "%4u of %u frames", count, cf->count); |
| 1623 | | | update_progress_dlg(progbar, progbar_val, status_str); |
| 1624 | | | } |
| 1625 | | | |
| 1626 | | | progbar_nextstep += progbar_quantum; |
| 1627 | | | } |
| 1628 | | | |
| 1629 | | | if (stop_flag) { |
| 1630 | | | |
| 1631 | | | |
| 1632 | | | |
| 1633 | | | |
| 1634 | | | |
| 1635 | | | |
| 1636 | | | |
| 1637 | | | |
| 1638 | | | |
| 1639 | | | |
| 1640 | | | |
| 1641 | | | |
| 1642 | | | break; |
| 1643 | | | } |
| 1644 | | | |
| 1645 | | | count++; |
| 1646 | | | |
| 1647 | | | if (redissect) { |
| 1648 | | | |
| 1649 | | | |
| 1650 | | | |
| 1651 | | | |
| 1652 | | | fdata->flags.visited = 0; |
| 1653 | | | if (fdata->pfd) { |
| 1654 | | | g_slist_free(fdata->pfd); |
| 1655 | | | fdata->pfd = NULL; |
| 1656 | | | } |
| 1657 | | | } |
| 1658 | | | |
| 1659 | | | if (!wtap_seek_read (cf->wth, fdata->file_off, &cf->, |
| 1660 | | | cf->pd, fdata->cap_len, &err, &err_info)) { |
| 1661 | | | simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, |
| 1662 | | | cf_read_error_message(err, err_info), cf->filename); |
Format String
simple_dialog() is being called with a format string that is not constant. The format string (third argument) may not match the other arguments to simple_dialog(); this could lead to security or stability problems. simple_dialog() is usually called with strings that look like format strings in this project. |
|
| 1663 | | | break; |
| 1664 | | | } |
| 1665 | | | |
| 1666 | | | |
| 1667 | | | |
| 1668 | | | |
| 1669 | | | if (prev_row != -1 && !selected_frame_seen) { |
| 1670 | | | preceding_row = prev_row; |
| 1671 | | | preceding_frame = prev_frame; |
| 1672 | | | } |
| 1673 | | | row = add_packet_to_packet_list(fdata, cf, dfcode, &cf->, cf->pd, |
| 1674 | | | refilter); |
| 1675 | | | |
| 1676 | | | |
| 1677 | | | |
| 1678 | | | |
| 1679 | | | |
| 1680 | | | if (row != -1 && selected_frame_seen && following_row == -1) { |
| 1681 | | | following_row = row; |
| 1682 | | | following_frame = fdata; |
| 1683 | | | } |
| 1684 | | | if (fdata == selected_frame) { |
| 1685 | | | selected_row = row; |
| 1686 | | | selected_frame_seen = TRUE; |
| 1687 | | | } |
| 1688 | | | |
| 1689 | | | |
| 1690 | | | |
| 1691 | | | prev_row = row; |
| 1692 | | | prev_frame = fdata; |
| 1693 | | | } |
| 1694 | | | |
| 1695 | | | |
| 1696 | | | cf->redissecting = FALSE; |
| 1697 | | | |
| 1698 | | | |
| 1699 | | | packet_list_set_sort_column(); |
| 1700 | | | |
| 1701 | | | if (redissect) { |
| 1702 | | | |
| 1703 | | | |
| 1704 | | | |
| 1705 | | | |
| 1706 | | | |
| 1707 | | | |
| 1708 | | | |
| 1709 | | | |
| 1710 | | | |
| 1711 | | | for (; fdata != NULL; fdata = fdata->next) { |
| 1712 | | | fdata->flags.visited = 0; |
| 1713 | | | if (fdata->pfd) { |
| 1714 | | | g_slist_free(fdata->pfd); |
| 1715 | | | fdata->pfd = NULL; |
| 1716 | | | } |
| 1717 | | | } |
| 1718 | | | } |
| 1719 | | | |
| 1720 | | | |
| 1721 | | | |
| 1722 | | | if (progbar != NULL) |
| 1723 | | | destroy_progress_dlg(progbar); |
| 1724 | | | |
| 1725 | | | |
| 1726 | | | packet_list_thaw(); |
| 1727 | | | |
| 1728 | | | if (selected_row == -1) { |
| 1729 | | | |
| 1730 | | | if (selected_frame == NULL) { |
| 1731 | | | |
| 1732 | | | |
| 1733 | | | selected_row = 0; |
| 1734 | | | } else { |
| 1735 | | | |
| 1736 | | | |
| 1737 | | | |
| 1738 | | | |
| 1739 | | | g_assert(following_frame == NULL ||
x /usr/include/glib-2.0/glib/gtestutils.h |
| |
74 | #define g_assert(expr) do { if G_LIKELY (expr) ; else \ |
75 | g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ |
76 | #expr); } while (0) |
| |
x /usr/include/glib-2.0/glib/gmacros.h |
| |
277 | #define G_LIKELY(expr) (__builtin_expect (_G_BOOLEAN_EXPR(expr), 1)) |
| |
x /usr/include/glib-2.0/glib/gmacros.h |
| |
268 | #define _G_BOOLEAN_EXPR(expr) \ |
269 | __extension__ ({ \ |
270 | int _g_boolean_var_; \ |
271 | if (expr) \ |
272 | _g_boolean_var_ = 1; \ |
273 | else \ |
274 | _g_boolean_var_ = 0; \ |
275 | _g_boolean_var_; \ |
276 | }) |
| |
x /usr/include/glib-2.0/glib/gmacros.h |
| |
160 | # define G_STRFUNC ((const char*) (__PRETTY_FUNCTION__)) |
| |
|
| 1740 | | | following_frame->num >= selected_frame->num); |
| 1741 | | | g_assert(preceding_frame == NULL ||
x /usr/include/glib-2.0/glib/gtestutils.h |
| |
74 | #define g_assert(expr) do { if G_LIKELY (expr) ; else \ |
75 | g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ |
76 | #expr); } while (0) |
| |
x /usr/include/glib-2.0/glib/gmacros.h |
| |
277 | #define G_LIKELY(expr) (__builtin_expect (_G_BOOLEAN_EXPR(expr), 1)) |
| |
x /usr/include/glib-2.0/glib/gmacros.h |
| |
268 | #define _G_BOOLEAN_EXPR(expr) \ |
269 | __extension__ ({ \ |
270 | int _g_boolean_var_; \ |
271 | if (expr) \ |
272 | _g_boolean_var_ = 1; \ |
273 | else \ |
274 | _g_boolean_var_ = 0; \ |
275 | _g_boolean_var_; \ |
276 | }) |
| |
x /usr/include/glib-2.0/glib/gmacros.h |
| |
160 | # define G_STRFUNC ((const char*) (__PRETTY_FUNCTION__)) |
| |
|
| 1742 | | | preceding_frame->num <= selected_frame->num); |
| 1743 | | | if (following_frame == NULL) { |
| 1744 | | | |
| 1745 | | | |
| 1746 | | | |
| 1747 | | | selected_row = preceding_row; |
| 1748 | | | } else if (preceding_frame == NULL) { |
| 1749 | | | |
| 1750 | | | |
| 1751 | | | |
| 1752 | | | selected_row = following_row; |
| 1753 | | | } else { |
| 1754 | | | |
| 1755 | | | |
| 1756 | | | selected_row = preceding_row; |
| 1757 | | | } |
| 1758 | | | } |
| 1759 | | | } |
| 1760 | | | |
| 1761 | | | if (selected_row == -1) { |
| 1762 | | | |
| 1763 | | | cf_unselect_packet(cf); |
| 1764 | | | } else { |
| 1765 | | | |
| 1766 | | | |
| 1767 | | | |
| 1768 | | | if (selected_row == 0) { |
| 1769 | | | |
| 1770 | | | cf->current_row = -1; |
| 1771 | | | } |
| 1772 | | | packet_list_set_selected_row(selected_row); |
| 1773 | | | } |
| 1774 | | | |
| 1775 | | | |
| 1776 | | | if (dfcode != NULL){ |
| 1777 | | | dfilter_free(dfcode); |
| 1778 | | | } |
| 1779 | | | } |
| |