(/home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/commview.c) |
| |
| 317 | | | static gboolean commview_dump(wtap_dumper *wdh, |
| 318 | | | const struct wtap_pkthdr *phdr, |
| 319 | | | const union *, |
| 320 | | | const guchar *pd, int *err) |
| 321 | | | { |
| 322 | | | cv_hdr; |
| 323 | | | size_t bytes_written = 0; |
| 324 | | | char date_time[5]; |
| 325 | | | |
| 326 | | | memset(&cv_hdr, 0, sizeof(cv_hdr)); |
| 327 | | | |
| 328 | | | cv_hdr.data_len = GUINT16_TO_LE((guint16)phdr->caplen); |
| 329 | | | cv_hdr.source_data_len = GUINT16_TO_LE((guint16)phdr->caplen); |
| 330 | | | cv_hdr.version = 0; |
| 331 | | | |
| 332 | | | strftime(date_time, 5, "%Y", localtime(&phdr->ts.secs)); |
| 333 | | | cv_hdr.year = GUINT16_TO_LE((guint16)strtol(date_time, NULL, 10)); |
| 334 | | | |
| 335 | | | strftime(date_time, 5, "%m", localtime(&phdr->ts.secs)); |
| 336 | | | cv_hdr.month = (guint8)strtol(date_time, NULL, 10); |
| 337 | | | |
| 338 | | | strftime(date_time, 5, "%d", localtime(&phdr->ts.secs)); |
| 339 | | | cv_hdr.day = (guint8)strtol(date_time, NULL, 10); |
| 340 | | | |
| 341 | | | strftime(date_time, 5, "%H", localtime(&phdr->ts.secs)); |
Event 1:
localtime() returns NULL. - Dereferenced later, causing the null pointer dereference.
hide
Event 2:
localtime(&phdr->ts.secs), which evaluates to NULL, is passed to strftime() as the fourth argument. See related event 1.
hide
Null Pointer Dereference
The body of strftime() dereferences localtime(&phdr->ts.secs), but it is NULL. The issue can occur if the highlighted code executes. See related event 2. Show: All events | Only primary events |
|
| |