Use the packet length read from the packet header when reading packets
authorGuy Harris <guy@alum.mit.edu>
Tue, 31 Dec 2013 23:31:44 +0000 (23:31 -0000)
committerGuy Harris <guy@alum.mit.edu>
Tue, 31 Dec 2013 23:31:44 +0000 (23:31 -0000)
randomly.

svn path=/trunk/; revision=54518

wiretap/netscreen.c

index 947cc8a53314cdd340a6308eb19677e9d8127203..80ef74cc19376ca8245220c1b6c306ee4dd16e53 100644 (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;
 }