aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2013-12-31 23:30:39 +0000
committerGuy Harris <guy@alum.mit.edu>2013-12-31 23:30:39 +0000
commit31d74c1922daae28586efa2a18ae1f7887e0d85c (patch)
tree79a1f4552c95e67b3bbe4cfab8938582da0a395b /wiretap
parent4648f411a77ec772bc1041d99231713213ab4653 (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=54517
Diffstat (limited to 'wiretap')
-rw-r--r--wiretap/aethra.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/wiretap/aethra.c b/wiretap/aethra.c
index 43a387bc1f..3f7dc450bd 100644
--- a/wiretap/aethra.c
+++ b/wiretap/aethra.c
@@ -278,20 +278,24 @@ found:
static gboolean
aethra_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)
{
struct aethrarec_hdr hdr;
if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
return FALSE;
- if (!aethra_read_rec_header(wth, wth->random_fh, &hdr, phdr, err, err_info))
+ if (!aethra_read_rec_header(wth, wth->random_fh, &hdr, phdr, err,
+ err_info)) {
+ if (*err == 0)
+ *err = WTAP_ERR_SHORT_READ;
return FALSE;
+ }
/*
* Read the packet data.
*/
- if (!wtap_read_packet_bytes(wth->random_fh, buf, length, err, err_info))
+ if (!wtap_read_packet_bytes(wth->random_fh, buf, phdr->caplen, err, err_info))
return FALSE; /* failed */
return TRUE;