diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-09-22 18:37:50 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-09-23 02:10:35 +0000 |
commit | be3246060e465d118afa8cc80a3015bdec8ffde6 (patch) | |
tree | c7123c30e99d3ed8e91a857d8ce747b6a47981b8 /wiretap/peekclassic.c | |
parent | e543818734975e70d88752bdc898c30c09e48950 (diff) |
Make peekclassic_read_packet_v56() more like the _v7 version.
We can't use wtap_file_read_expected_bytes() in the _v7 version, as that
version returns an int, not a Boolean; just expand
wtap_file_read_expected_bytes() in the _v56 version, to make it look
similar to the _v7 version.
Change-Id: Id907bac265c123ad5821591c1cf081b5747724d8
Reviewed-on: https://code.wireshark.org/review/4262
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap/peekclassic.c')
-rw-r--r-- | wiretap/peekclassic.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/wiretap/peekclassic.c b/wiretap/peekclassic.c index db6a97b2fd..2167cbd645 100644 --- a/wiretap/peekclassic.c +++ b/wiretap/peekclassic.c @@ -532,6 +532,7 @@ static gboolean peekclassic_read_packet_v56(wtap *wth, FILE_T fh, { peekclassic_t *peekclassic = (peekclassic_t *)wth->priv; guint8 ep_pkt[PEEKCLASSIC_V56_PKT_SIZE]; + int bytes_read; guint16 length; guint16 sliceLength; #if 0 @@ -549,8 +550,13 @@ static gboolean peekclassic_read_packet_v56(wtap *wth, FILE_T fh, #endif unsigned int i; - wtap_file_read_expected_bytes(ep_pkt, sizeof(ep_pkt), fh, err, - err_info); + bytes_read = file_read(ep_pkt, sizeof(ep_pkt), fh); + if (bytes_read != (int) sizeof(ep_pkt)) { + *err = file_error(fh, err_info); + if (*err == 0 && bytes_read > 0) + *err = WTAP_ERR_SHORT_READ; + return FALSE; + } /* Extract the fields from the packet */ length = pntoh16(&ep_pkt[PEEKCLASSIC_V56_LENGTH_OFFSET]); |