From 4648f411a77ec772bc1041d99231713213ab4653 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Tue, 31 Dec 2013 23:30:18 +0000 Subject: Use the packet length read from the packet header, and check for an EOF and treat it as an error, when reading packets randomly. svn path=/trunk/; revision=54516 --- wiretap/5views.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'wiretap') diff --git a/wiretap/5views.c b/wiretap/5views.c index 538402f4ba..48d0c7a750 100644 --- a/wiretap/5views.c +++ b/wiretap/5views.c @@ -243,7 +243,7 @@ _5views_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) static gboolean _5views_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr, - Buffer *buf, int length, int *err, gchar **err_info) + Buffer *buf, int length _U_, int *err, gchar **err_info) { t_5VW_TimeStamped_Header TimeStamped_Header; @@ -254,13 +254,16 @@ _5views_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr, * Read the header. */ if (!_5views_read_header(wth, wth->random_fh, &TimeStamped_Header, - phdr, err, err_info)) + phdr, err, err_info)) { + if (*err == 0) + *err = WTAP_ERR_SHORT_READ; return FALSE; + } /* * Read the packet data. */ - return wtap_read_packet_bytes(wth->random_fh, buf, length, + return wtap_read_packet_bytes(wth->random_fh, buf, phdr->caplen, err, err_info); } -- cgit v1.2.3