Use the packet length read from the packet header when reading packets

randomly.

svn path=/trunk/; revision=54518
This commit is contained in:
Guy Harris 2013-12-31 23:31:44 +00:00
parent 31d74c1922
commit cd13dd3782
1 changed files with 9 additions and 8 deletions

View File

@ -208,8 +208,8 @@ static gboolean netscreen_read(wtap *wth, int *err, gchar **err_info,
return FALSE;
/* Parse the header */
pkt_len = parse_netscreen_rec_hdr(&wth->phdr, line, cap_int, &cap_dir, cap_dst,
err, err_info);
pkt_len = parse_netscreen_rec_hdr(&wth->phdr, line, cap_int, &cap_dir,
cap_dst, err, err_info);
if (pkt_len == -1)
return FALSE;
@ -241,9 +241,10 @@ static gboolean netscreen_read(wtap *wth, int *err, gchar **err_info,
/* Used to read packets in random-access fashion */
static gboolean
netscreen_seek_read(wtap *wth, gint64 seek_off,
struct wtap_pkthdr *phdr, Buffer *buf, int len,
struct wtap_pkthdr *phdr, Buffer *buf, int len _U_,
int *err, gchar **err_info)
{
int pkt_len;
char line[NETSCREEN_LINE_LENGTH];
char cap_int[NETSCREEN_MAX_INT_NAME_LENGTH];
gboolean cap_dir;
@ -261,13 +262,13 @@ netscreen_seek_read(wtap *wth, gint64 seek_off,
return FALSE;
}
if (parse_netscreen_rec_hdr(phdr, line, cap_int, &cap_dir, cap_dst,
err, err_info) == -1) {
pkt_len = parse_netscreen_rec_hdr(phdr, line, cap_int, &cap_dir,
cap_dst, err, err_info);
if (pkt_len == -1)
return FALSE;
}
if (!parse_netscreen_hex_dump(wth->random_fh, len, cap_int, cap_dst,
phdr, buf, err, err_info))
if (!parse_netscreen_hex_dump(wth->random_fh, pkt_len, cap_int,
cap_dst, phdr, buf, err, err_info))
return FALSE;
return TRUE;
}