(/home/sate/Testcases/c/cve/wireshark-1.2.0/file.c) |
| |
| 1788 | | | process_specified_packets(capture_file *cf, packet_range_t *range, |
| 1789 | | | const char *string1, const char *string2, gboolean terminate_is_stop, |
| 1790 | | | gboolean (*callback)(capture_file *, frame_data *, |
| 1791 | | | union *, const guint8 *, void *), |
| 1792 | | | void *callback_args) |
| 1793 | | | { |
| 1794 | | | frame_data *fdata; |
| 1795 | | | int err; |
| 1796 | | | gchar *err_info; |
| 1797 | | | union ; |
| 1798 | | | guint8 pd[WTAP_MAX_PACKET_SIZE+1]; |
| 1799 | | | psp_return_t ret = PSP_FINISHED; |
| 1800 | | | |
| 1801 | | | progdlg_t *progbar = NULL; |
| 1802 | | | int progbar_count; |
| 1803 | | | float progbar_val; |
| 1804 | | | gboolean progbar_stop_flag; |
| 1805 | | | GTimeVal progbar_start_time; |
| 1806 | | | gchar progbar_status_str[100]; |
| 1807 | | | int progbar_nextstep; |
| 1808 | | | int progbar_quantum; |
| 1809 | | | range_process_e process_this; |
| 1810 | | | |
| 1811 | | | |
| 1812 | | | progbar_nextstep = 0; |
| 1813 | | | |
| 1814 | | | |
| 1815 | | | progbar_quantum = cf->count/N_PROGBAR_UPDATES; |
| 1816 | | | |
| 1817 | | | progbar_count = 0; |
| 1818 | | | |
| 1819 | | | progbar_val = 0.0f; |
| 1820 | | | |
| 1821 | | | progbar_stop_flag = FALSE; |
| 1822 | | | g_get_current_time(&progbar_start_time); |
| 1823 | | | |
| 1824 | | | packet_range_process_init(range); |
| 1825 | | | |
| 1826 | | | |
| 1827 | | | |
| 1828 | | | for (fdata = cf->plist; fdata != NULL; fdata = fdata->next) { |
| 1829 | | | |
| 1830 | | | |
| 1831 | | | |
| 1832 | | | |
| 1833 | | | |
| 1834 | | | if (progbar == NULL) |
| 1835 | | | progbar = delayed_create_progress_dlg(string1, string2, |
| 1836 | | | terminate_is_stop, |
| 1837 | | | &progbar_stop_flag, |
| 1838 | | | &progbar_start_time, |
| 1839 | | | progbar_val); |
| 1840 | | | |
| 1841 | | | |
| 1842 | | | |
| 1843 | | | |
| 1844 | | | |
| 1845 | | | |
| 1846 | | | if (progbar_count >= progbar_nextstep) { |
| 1847 | | | |
| 1848 | | | |
| 1849 | | | |
| 1850 | | | 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__)) |
| |
|
| 1851 | | | progbar_val = (gfloat) progbar_count / cf->count; |
| 1852 | | | |
| 1853 | | | if (progbar != NULL) { |
| 1854 | | | g_snprintf(progbar_status_str, sizeof(progbar_status_str), |
| 1855 | | | "%4u of %u packets", progbar_count, cf->count); |
| 1856 | | | update_progress_dlg(progbar, progbar_val, progbar_status_str); |
| 1857 | | | } |
| 1858 | | | |
| 1859 | | | progbar_nextstep += progbar_quantum; |
| 1860 | | | } |
| 1861 | | | |
| 1862 | | | if (progbar_stop_flag) { |
| 1863 | | | |
| 1864 | | | |
| 1865 | | | |
| 1866 | | | ret = PSP_STOPPED; |
| 1867 | | | break; |
| 1868 | | | } |
| 1869 | | | |
| 1870 | | | progbar_count++; |
| 1871 | | | |
| 1872 | | | |
| 1873 | | | process_this = packet_range_process_packet(range, fdata); |
| 1874 | | | if (process_this == range_process_next) { |
| 1875 | | | |
| 1876 | | | continue; |
| 1877 | | | } else if (process_this == range_processing_finished) { |
| 1878 | | | |
| 1879 | | | break; |
| 1880 | | | } |
| 1881 | | | |
| 1882 | | | |
| 1883 | | | if (!wtap_seek_read(cf->wth, fdata->file_off, &, |
| 1884 | | | pd, fdata->cap_len, &err, &err_info)) { |
| 1885 | | | |
| 1886 | | | simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, |
| 1887 | | | 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. |
|
| 1888 | | | ret = PSP_FAILED; |
| 1889 | | | break; |
| 1890 | | | } |
| 1891 | | | |
| 1892 | | | if (!callback(cf, fdata, &, pd, callback_args)) { |
| 1893 | | | |
| 1894 | | | ret = PSP_FAILED; |
| 1895 | | | break; |
| 1896 | | | } |
| 1897 | | | } |
| 1898 | | | |
| 1899 | | | |
| 1900 | | | |
| 1901 | | | if (progbar != NULL) |
| 1902 | | | destroy_progress_dlg(progbar); |
| 1903 | | | |
| 1904 | | | return ret; |
| 1905 | | | } |
| |