localtime() can return a NULL ptr.
authorwmeier <wmeier@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 12 Apr 2011 13:21:32 +0000 (13:21 +0000)
committerwmeier <wmeier@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 12 Apr 2011 13:21:32 +0000 (13:21 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@36580 f5534014-38df-0310-8fa8-9805f1628bb7

plugins/gryphon/packet-gryphon.c

index d4ec4a14208c79b98166a194a4dd8a3dd271d92a..63bf50d617534a25f2b98b9aa2bc99048a4a4814 100644 (file)
@@ -918,15 +918,21 @@ resp_time(tvbuff_t *tvb, int offset, proto_tree *pt)
     ts = tvb_get_ntoh64(tvb, offset);
     timestamp = (time_t) (ts / 100000);
     tmp = localtime(&timestamp);
-    proto_tree_add_text(pt, tvb, offset, 8,
-        "Date/Time: %s %d, %d %02d:%02d:%02d.%05u",
-        mon_names[tmp->tm_mon],
-        tmp->tm_mday,
-        tmp->tm_year + 1900,
-        tmp->tm_hour,
-        tmp->tm_min,
-        tmp->tm_sec,
-        (guint) (ts % 100000));
+
+    if (tmp) {
+        proto_tree_add_text(pt, tvb, offset, 8,
+                            "Date/Time: %s %d, %d %02d:%02d:%02d.%05u",
+                            mon_names[tmp->tm_mon],
+                            tmp->tm_mday,
+                            tmp->tm_year + 1900,
+                            tmp->tm_hour,
+                            tmp->tm_min,
+                            tmp->tm_sec,
+                            (guint) (ts % 100000));
+    } else {
+        proto_tree_add_text(pt, tvb, offset, 8,
+                            "Date/Time: [Invalid]");
+    }
     offset += 8;
     return offset;
 }