(/home/sate/Testcases/c/cve/wireshark-1.2.0/gtk/summary_dlg.c) |
| |
| 104 | | | summary_open_cb(GtkWidget *w _U_, gpointer d _U_) |
| 105 | | | { |
| 106 | | | summary_tally summary; |
| 107 | | | GtkWidget *sum_open_w, |
| 108 | | | *main_vb, *bbox, *close_bt, *help_bt; |
| 109 | | | GtkWidget *table; |
| 110 | | | GtkWidget *list; |
| 111 | | | static const char *titles[] = { "Traffic", "Captured", "Displayed", "Marked" }; |
| 112 | | | |
| 113 | | | gchar string_buff[SUM_STR_MAX]; |
| 114 | | | gchar string_buff2[SUM_STR_MAX]; |
| 115 | | | gchar string_buff3[SUM_STR_MAX]; |
| 116 | | | |
| 117 | | | double seconds; |
| 118 | | | double disp_seconds; |
| 119 | | | double marked_seconds; |
| 120 | | | guint offset; |
| 121 | | | guint snip; |
| 122 | | | guint row; |
| 123 | | | gchar *str_dup; |
| 124 | | | gchar *str_work; |
| 125 | | | |
| 126 | | | time_t ti_time; |
| 127 | | | struct tm *ti_tm; |
| 128 | | | unsigned int elapsed_time; |
| 129 | | | |
| 130 | | | |
| 131 | | | summary_fill_in(&cfile, &summary); |
| 132 | | | #ifdef HAVE_LIBPCAP |
| 133 | | | summary_fill_in_capture(&global_capture_opts, &summary); |
| 134 | | | #endif |
| 135 | | | seconds = summary.stop_time - summary.start_time; |
| 136 | | | disp_seconds = summary.filtered_stop - summary.filtered_start; |
| 137 | | | marked_seconds = summary.marked_stop - summary.marked_start; |
| 138 | | | |
| 139 | | | sum_open_w = window_new(GTK_WINDOW_TOPLEVEL, "Wireshark: Summary"); |
| 140 | | | |
| 141 | | | |
| 142 | | | main_vb = gtk_vbox_new(FALSE, 12); |
| 143 | | | gtk_container_set_border_width(GTK_CONTAINER(main_vb), 12);
x /usr/include/gtk-2.0/gtk/gtkcontainer.h |
| |
42 | #define GTK_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CONTAINER, GtkContainer)) |
| |
x /usr/include/glib-2.0/gobject/gtype.h |
| |
482 | #define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type) (_G_TYPE_CIC ((instance), (g_type), c_type)) |
| |
x /usr/include/glib-2.0/gobject/gtype.h |
| |
1678 | # define _G_TYPE_CIC(ip, gt, ct) \ |
1679 | ((ct*) g_type_check_instance_cast ((GTypeInstance*) ip, gt)) |
| |
x /usr/include/gtk-2.0/gtk/gtkcontainer.h |
| |
41 | #define GTK_TYPE_CONTAINER (gtk_container_get_type ()) |
| |
|
| 144 | | | gtk_container_add(GTK_CONTAINER(sum_open_w), main_vb);
x /usr/include/gtk-2.0/gtk/gtkcontainer.h |
| |
42 | #define GTK_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CONTAINER, GtkContainer)) |
| |
x /usr/include/glib-2.0/gobject/gtype.h |
| |
482 | #define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type) (_G_TYPE_CIC ((instance), (g_type), c_type)) |
| |
x /usr/include/glib-2.0/gobject/gtype.h |
| |
1678 | # define _G_TYPE_CIC(ip, gt, ct) \ |
1679 | ((ct*) g_type_check_instance_cast ((GTypeInstance*) ip, gt)) |
| |
x /usr/include/gtk-2.0/gtk/gtkcontainer.h |
| |
41 | #define GTK_TYPE_CONTAINER (gtk_container_get_type ()) |
| |
|
| 145 | | | |
| 146 | | | |
| 147 | | | table = gtk_table_new(1, 2, FALSE); |
| 148 | | | gtk_table_set_col_spacings(GTK_TABLE(table), 6);
x /usr/include/gtk-2.0/gtk/gtktable.h |
| |
41 | #define GTK_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TABLE, GtkTable)) |
| |
x /usr/include/glib-2.0/gobject/gtype.h |
| |
482 | #define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type) (_G_TYPE_CIC ((instance), (g_type), c_type)) |
| |
x /usr/include/glib-2.0/gobject/gtype.h |
| |
1678 | # define _G_TYPE_CIC(ip, gt, ct) \ |
1679 | ((ct*) g_type_check_instance_cast ((GTypeInstance*) ip, gt)) |
| |
x /usr/include/gtk-2.0/gtk/gtktable.h |
| |
40 | #define GTK_TYPE_TABLE (gtk_table_get_type ()) |
| |
|
| 149 | | | gtk_table_set_row_spacings(GTK_TABLE(table), 3);
x /usr/include/gtk-2.0/gtk/gtktable.h |
| |
41 | #define GTK_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TABLE, GtkTable)) |
| |
x /usr/include/glib-2.0/gobject/gtype.h |
| |
482 | #define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type) (_G_TYPE_CIC ((instance), (g_type), c_type)) |
| |
x /usr/include/glib-2.0/gobject/gtype.h |
| |
1678 | # define _G_TYPE_CIC(ip, gt, ct) \ |
1679 | ((ct*) g_type_check_instance_cast ((GTypeInstance*) ip, gt)) |
| |
x /usr/include/gtk-2.0/gtk/gtktable.h |
| |
40 | #define GTK_TYPE_TABLE (gtk_table_get_type ()) |
| |
|
| 150 | | | gtk_container_add(GTK_CONTAINER(main_vb), table);
x /usr/include/gtk-2.0/gtk/gtkcontainer.h |
| |
42 | #define GTK_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CONTAINER, GtkContainer)) |
| |
x /usr/include/glib-2.0/gobject/gtype.h |
| |
482 | #define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type) (_G_TYPE_CIC ((instance), (g_type), c_type)) |
| |
x /usr/include/glib-2.0/gobject/gtype.h |
| |
1678 | # define _G_TYPE_CIC(ip, gt, ct) \ |
1679 | ((ct*) g_type_check_instance_cast ((GTypeInstance*) ip, gt)) |
| |
x /usr/include/gtk-2.0/gtk/gtkcontainer.h |
| |
41 | #define GTK_TYPE_CONTAINER (gtk_container_get_type ()) |
| |
|
| 151 | | | row = 0; |
| 152 | | | |
| 153 | | | |
| 154 | | | |
| 155 | | | add_string_to_table(table, &row, "File", ""); |
| 156 | | | |
| 157 | | | |
| 158 | | | g_snprintf(string_buff, SUM_STR_MAX, "%s", summary.filename); |
| 159 | | | add_string_to_table(table, &row, "Name:", string_buff); |
| 160 | | | |
| 161 | | | |
| 162 | | | g_snprintf(string_buff, SUM_STR_MAX, "%" G_GINT64_MODIFIER "d bytes", summary.file_length); |
| 163 | | | add_string_to_table(table, &row, "Length:", string_buff); |
| 164 | | | |
| 165 | | | |
| 166 | | | g_snprintf(string_buff, SUM_STR_MAX, "%s", wtap_file_type_string(summary.file_type)); |
| 167 | | | add_string_to_table(table, &row, "Format:", string_buff); |
| 168 | | | |
| 169 | | | |
| 170 | | | g_snprintf(string_buff, SUM_STR_MAX, "%s", wtap_encap_string(summary.encap_type)); |
| 171 | | | add_string_to_table(table, &row, "Encapsulation:", string_buff); |
| 172 | | | |
| 173 | | | if (summary.has_snap) { |
Event 22:
Skipping " if". summary.has_snap evaluates to false.
hide
|
|
| 174 | | | |
| 175 | | | g_snprintf(string_buff, SUM_STR_MAX, "%u bytes", summary.snap); |
| 176 | | | add_string_to_table(table, &row, "Packet size limit:", string_buff); |
| 177 | | | } |
| 178 | | | |
| 179 | | | |
| 180 | | | |
| 181 | | | add_string_to_table(table, &row, "", ""); |
| 182 | | | add_string_to_table(table, &row, "Time", ""); |
| 183 | | | |
| 184 | | | |
| 185 | | | ti_time = (time_t)summary.start_time; |
| 186 | | | ti_tm = localtime(&ti_time); |
Event 23:
localtime() returns NULL. - Dereferenced later, causing the null pointer dereference.
hide
Event 24:
ti_tm is set to localtime(&ti_time), which evaluates to NULL. See related event 23.
hide
|
|
| 187 | | | g_snprintf(string_buff, SUM_STR_MAX, |
| 188 | | | "%04d-%02d-%02d %02d:%02d:%02d", |
| 189 | | | ti_tm->tm_year + 1900, |
| 190 | | | ti_tm->tm_mon + 1, |
| 191 | | | ti_tm->tm_mday, |
| 192 | | | ti_tm->tm_hour, |
| 193 | | | ti_tm->tm_min, |
| 194 | | | ti_tm->tm_sec); |
Null Pointer Dereference
ti_tm is dereferenced here, but it is NULL. The issue can occur if the highlighted code executes. See related event 24. Show: All events | Only primary events |
|
| |