Browse code

sipdump: move use of spd fields after safety check

Daniel-Constantin Mierla authored on 08/09/2020 10:52:53
Showing 1 changed files
... ...
@@ -125,8 +125,8 @@ void sipdump_write_pcap(FILE *fs, sipdump_data_t *spd)
125 125
 	char *p = NULL;
126 126
 
127 127
 	struct pcap_record_header v_pcap_record_header = {
128
-		.ts_sec = spd->tv.tv_sec,
129
-		.ts_usec = spd->tv.tv_usec,
128
+		.ts_sec = 0,
129
+		.ts_usec = 0,
130 130
 	};
131 131
 	struct pcap_ethernet_header v_pcap_ethernet_header = {
132 132
 		.type = 0,
... ...
@@ -148,6 +148,9 @@ void sipdump_write_pcap(FILE *fs, sipdump_data_t *spd)
148 148
 		return;
149 149
 	}
150 150
 
151
+	v_pcap_record_header.ts_sec = spd->tv.tv_sec;
152
+	v_pcap_record_header.ts_usec = spd->tv.tv_usec;
153
+
151 154
 	data = spd->data;
152 155
 	if((sipdump_mode & SIPDUMP_MODE_WPCAPEX) && (spd->data.len < BUF_SIZE - 256)) {
153 156
 		if(_sipdump_pcap_data_buf == NULL) {