(/home/sate/Testcases/c/cve/wireshark-1.2.0/ringbuffer.c) |
| |
| 97 | | | static int ringbuf_open_file(rb_file *rfile, int *err) |
| 98 | | | { |
| 99 | | | char filenum[5+1]; |
| 100 | | | char timestr[14+1]; |
| 101 | | | time_t current_time; |
| 102 | | | |
| 103 | | | if (rfile->name != NULL) { |
Event 1:
Skipping " if". rfile->name != (void *)0 evaluates to false.
hide
|
|
| 104 | | | if (rb_data.unlimited == FALSE) { |
| 105 | | | |
| 106 | | | ws_unlink(rfile->name); |
| 107 | | | } |
| 108 | | | g_free(rfile->name); |
| 109 | | | } |
| 110 | | | |
| 111 | | | #ifdef _WIN32 |
| 112 | | | _tzset(); |
| 113 | | | #endif |
| 114 | | | current_time = time(NULL); |
| 115 | | | |
| 116 | | | g_snprintf(filenum, sizeof(filenum), "%05u", (rb_data.curr_file_num + 1) % 100000); |
| 117 | | | strftime(timestr, sizeof(timestr), "%Y%m%d%H%M%S", localtime(¤t_time)); |
Event 3:
localtime() returns NULL. - Dereferenced later, causing the null pointer dereference.
hide
Event 4:
localtime(¤t_time), which evaluates to NULL, is passed to strftime() as the fourth argument. See related event 3.
hide
Null Pointer Dereference
The body of strftime() dereferences localtime(¤t_time), but it is NULL. The issue can occur if the highlighted code executes. See related event 4. Show: All events | Only primary events |
|
| |