(/home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/network_instruments.c) |
| |
| 469 | | | gboolean network_instruments_dump_open(wtap_dumper *wdh, gboolean cant_seek, int *err) |
| 470 | | | { |
| 471 | | | ; |
| 472 | | | ; |
| 473 | | | char [64]; |
| 474 | | | struct tm *current_time; |
| 475 | | | time_t system_time; |
| 476 | | | |
| 477 | | | if (cant_seek) { |
Event 1:
Skipping " if". cant_seek evaluates to false.
hide
|
|
| 478 | | | *err = WTAP_ERR_CANT_WRITE_TO_PIPE; |
| 479 | | | return FALSE; |
| 480 | | | } |
| 481 | | | |
| 482 | | | wdh->subtype_write = observer_dump; |
| 483 | | | wdh->subtype_close = observer_dump_close; |
| 484 | | | |
| 485 | | | wdh->dump.niobserver = g_malloc(sizeof(niobserver_dump_t)); |
| 486 | | | wdh->dump.niobserver->packet_count = 0; |
| 487 | | | wdh->dump.niobserver->network_type = from_wtap_encap[wdh->encap]; |
| 488 | | | |
| 489 | | | |
| 490 | | | time(&system_time); |
| 491 | | | current_time = localtime(&system_time); |
Event 3:
localtime() returns NULL. - Dereferenced later, causing the null pointer dereference.
hide
Event 4:
current_time is set to localtime(&system_time), which evaluates to NULL. See related event 3.
hide
|
|
| 492 | | | memset(&, 0x00, sizeof()); |
| 493 | | | g_snprintf(, 64, "This capture was saved from Wireshark on %s", asctime(current_time)); |
Event 5:
current_time, which evaluates to NULL, is passed to asctime(). See related event 4.
hide
Null Pointer Dereference
The body of asctime() dereferences current_time, but it is NULL. The issue can occur if the highlighted code executes. See related event 5. Show: All events | Only primary events |
|
| |