aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2013-12-31 23:30:18 +0000
committerGuy Harris <guy@alum.mit.edu>2013-12-31 23:30:18 +0000
commit4648f411a77ec772bc1041d99231713213ab4653 (patch)
treed587ab1d94030481e26d08a28295a417e6de9d80 /wiretap
parenta4c1a7c4765450e37ae870f3f252186cb5ed42ae (diff)
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
Diffstat (limited to 'wiretap')
-rw-r--r--wiretap/5views.c9
1 files changed, 6 insertions, 3 deletions
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);
}