(/home/sate/Testcases/c/cve/wireshark-1.2.0/plugins/gryphon/packet-gryphon.c) |
| |
| 906 | | | resp_time(tvbuff_t *tvb, int offset, proto_tree *pt) |
| 907 | | | { |
| 908 | | | guint64 ts; |
| 909 | | | time_t timestamp; |
| 910 | | | struct tm *tmp; |
| 911 | | | static const char *mon_names[12] = { |
| 912 | | | "Jan", |
| 913 | | | "Feb", |
| 914 | | | "Mar", |
| 915 | | | "Apr", |
| 916 | | | "May", |
| 917 | | | "Jun", |
| 918 | | | "Jul", |
| 919 | | | "Aug", |
| 920 | | | "Sep", |
| 921 | | | "Oct", |
| 922 | | | "Nov", |
| 923 | | | "Dec" |
| 924 | | | }; |
| 925 | | | |
| 926 | | | ts = tvb_get_ntoh64(tvb, offset); |
| 927 | | | timestamp = (time_t) (ts / 100000); |
| 928 | | | tmp = localtime(×tamp); |
Event 1:
localtime() returns NULL. - Dereferenced later, causing the null pointer dereference.
hide
Event 2:
tmp is set to localtime(×tamp), which evaluates to NULL. See related event 1.
hide
|
|
| 929 | | | proto_tree_add_text(pt, tvb, offset, 8, |
| 930 | | | "Date/Time: %s %d, %d %02d:%02d:%02d.%05u", |
| 931 | | | mon_names[tmp->tm_mon], |
| 932 | | | tmp->tm_mday, |
| 933 | | | tmp->tm_year + 1900, |
| 934 | | | tmp->tm_hour, |
| 935 | | | tmp->tm_min, |
| 936 | | | tmp->tm_sec, |
Null Pointer Dereference
tmp is dereferenced here, but it is NULL. The issue can occur if the highlighted code executes. See related event 2. Show: All events | Only primary events |
|
| 937 | | | (guint) (ts % 100000)); |
| |