diff options
author | Guy Harris <guy@alum.mit.edu> | 2016-09-28 16:45:23 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2016-09-28 23:45:58 +0000 |
commit | 48a66835ee4f319ba7806a542bb2cf1f16a2ac06 (patch) | |
tree | f4b86d49b651fc55047f16d98b1c2401238e03ec /wiretap/k12.c | |
parent | a3ce2336b2a0e684a94d1e0046556bc0b42748f2 (diff) | |
download | wireshark-48a66835ee4f319ba7806a542bb2cf1f16a2ac06.tar.gz |
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/k12.c')
-rw-r--r-- | wiretap/k12.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/wiretap/k12.c b/wiretap/k12.c index b5558a0cf4..ba6cb2f46a 100644 --- a/wiretap/k12.c +++ b/wiretap/k12.c @@ -462,7 +462,7 @@ static gint get_record(k12_t *file_data, FILE_T fh, gint64 file_offset, * length? If the record length is always a multiple of * 4 bytes, that won't happen. */ - if ( ! file_skip( fh, K12_FILE_BLOB_LEN, err ) ) + if ( ! wtap_read_bytes( fh, NULL, K12_FILE_BLOB_LEN, err, err_info ) ) return -1; total_read += K12_FILE_BLOB_LEN; } @@ -545,7 +545,7 @@ static gint get_record(k12_t *file_data, FILE_T fh, gint64 file_offset, /* * Skip the blob. */ - if ( !file_skip( fh, K12_FILE_BLOB_LEN, err ) ) + if ( !wtap_read_bytes( fh, NULL, K12_FILE_BLOB_LEN, err, err_info ) ) return -1; total_read += K12_FILE_BLOB_LEN; |