Don't use the length argument to the seek-read routine; no other
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 2 Jan 2014 20:17:24 +0000 (20:17 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 2 Jan 2014 20:17:24 +0000 (20:17 +0000)
seek-read routine does that.

Pass the length we just filled in to buffer_assure_space() in the
seek-read routine, and use that in the memcpy() as well.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@54568 f5534014-38df-0310-8fa8-9805f1628bb7

wiretap/k12text.l

index 56ea91b6843c8912aaf29a1b33f5e7ba7caeabf2..077d5c6246aa4f4bbca5d98fbf9696f374ba56b3 100644 (file)
@@ -291,7 +291,7 @@ k12text_read(wtap *wth, int *err, char ** err_info, gint64 *data_offset)
 }
 
 static gboolean
-k12text_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr, Buffer *buf, int length, int *err, char **err_info)
+k12text_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr, Buffer *buf, int length _U_, int *err, char **err_info)
 {
        if ( file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1) {
                return FALSE;
@@ -312,18 +312,10 @@ k12text_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr, Buffer *
                return FALSE;
        }
 
-       /* verify frame length parsed this time against original frame length */
-       if (ii != (guint)length) {
-               /* What happened ? This now seems to have a different length than originally */
-               *err = WTAP_ERR_BAD_FILE;
-               *err_info = g_strdup("Incorrect frame length (program error ?)");
-               return FALSE;
-       }
-
        k12text_set_headers(phdr);
 
-       buffer_assure_space(buf, wth->phdr.caplen);
-       memcpy(buffer_start_ptr(buf), bb, length);
+       buffer_assure_space(buf, phdr->caplen);
+       memcpy(buffer_start_ptr(buf), bb, phdr->caplen);
 
        return TRUE;
 }