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
This commit is contained in:
Guy Harris 2013-12-31 23:30:18 +00:00
parent a4c1a7c476
commit 4648f411a7
1 changed files with 6 additions and 3 deletions

View File

@ -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);
}