forked from osmocom/wireshark
Fix crash when doing "tshark -2 -r file -w newfile".
We were using cf->buf in some places and a local variable buf in others; consistenly use the local variable. Have a local variable for the struct wtap_pkthdr while we're at it; with some work we may be able to get rid of the struct wtap_pkthdr and the Buffer in the capture_file structure. Change-Id: I4762e22e11ef576be6bf9015450d1a270dd3d16b Reviewed-on: https://code.wireshark.org/review/178 Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
parent
648769497a
commit
114d051aef
9
tshark.c
9
tshark.c
|
@ -3024,6 +3024,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
|
||||||
wtapng_section_t *shb_hdr;
|
wtapng_section_t *shb_hdr;
|
||||||
wtapng_iface_descriptions_t *idb_inf;
|
wtapng_iface_descriptions_t *idb_inf;
|
||||||
char appname[100];
|
char appname[100];
|
||||||
|
struct wtap_pkthdr phdr;
|
||||||
Buffer buf;
|
Buffer buf;
|
||||||
epan_dissect_t *edt = NULL;
|
epan_dissect_t *edt = NULL;
|
||||||
|
|
||||||
|
@ -3190,15 +3191,15 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
|
||||||
|
|
||||||
for (framenum = 1; err == 0 && framenum <= cf->count; framenum++) {
|
for (framenum = 1; err == 0 && framenum <= cf->count; framenum++) {
|
||||||
fdata = frame_data_sequence_find(cf->frames, framenum);
|
fdata = frame_data_sequence_find(cf->frames, framenum);
|
||||||
if (wtap_seek_read(cf->wth, fdata->file_off, &cf->phdr,
|
if (wtap_seek_read(cf->wth, fdata->file_off, &phdr, &buf, &err,
|
||||||
&buf, &err, &err_info)) {
|
&err_info)) {
|
||||||
if (process_packet_second_pass(cf, edt, fdata, &cf->phdr, &buf,
|
if (process_packet_second_pass(cf, edt, fdata, &phdr, &buf,
|
||||||
tap_flags)) {
|
tap_flags)) {
|
||||||
/* Either there's no read filtering or this packet passed the
|
/* Either there's no read filtering or this packet passed the
|
||||||
filter, so, if we're writing to a capture file, write
|
filter, so, if we're writing to a capture file, write
|
||||||
this packet out. */
|
this packet out. */
|
||||||
if (pdh != NULL) {
|
if (pdh != NULL) {
|
||||||
if (!wtap_dump(pdh, &cf->phdr, buffer_start_ptr(&cf->buf), &err)) {
|
if (!wtap_dump(pdh, &phdr, buffer_start_ptr(&buf), &err)) {
|
||||||
/* Error writing to a capture file */
|
/* Error writing to a capture file */
|
||||||
switch (err) {
|
switch (err) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue