aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/mpeg.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2016-09-28 16:45:23 -0700
committerGuy Harris <guy@alum.mit.edu>2016-09-28 23:45:58 +0000
commit48a66835ee4f319ba7806a542bb2cf1f16a2ac06 (patch)
treef4b86d49b651fc55047f16d98b1c2401238e03ec /wiretap/mpeg.c
parenta3ce2336b2a0e684a94d1e0046556bc0b42748f2 (diff)
Use wtap_read_bytes() to skip over bytes when reading a record.
Allow file_read() to take a null pointer as a buffer argument; a null argument means "do everything except copy the bytes from the file to the user buffer". That means that wtap_read_bytes() and wtap_read_bytes_or_eof() also support a null pointer as a buffer argument. Use wtap_read_bytes() with a null buffer argument rather than file_skip() to skip forward over data. This fixes some places where files were mis-identified as ERF files, as the ERF open heuristics now get a short "read" error if they try to skip over more bytes than exist in the file. Change-Id: I4f73499d877c1f582e2bcf9b045034880cb09622 Reviewed-on: https://code.wireshark.org/review/17974 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap/mpeg.c')
-rw-r--r--wiretap/mpeg.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/wiretap/mpeg.c b/wiretap/mpeg.c
index f572237ea2..1bfe48765e 100644
--- a/wiretap/mpeg.c
+++ b/wiretap/mpeg.c
@@ -101,7 +101,7 @@ mpeg_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
gint64 offset = file_tell(fh);
guint8 stream;
- if (!file_skip(fh, 3, err))
+ if (!wtap_read_bytes(fh, NULL, 3, err, err_info))
return FALSE;
if (!wtap_read_bytes(fh, &stream, sizeof stream, err, err_info))
@@ -121,7 +121,8 @@ mpeg_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
switch (pack >> 62) {
case 1:
- if (!file_skip(fh, 1, err))
+ if (!wtap_read_bytes(fh, NULL, 1, err,
+ err_info))
return FALSE;
if (!wtap_read_bytes(fh, &stuffing,
sizeof stuffing, err, err_info))