summaryrefslogtreecommitdiff
path: root/wiretap/i4btrace.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2000-11-19 03:47:36 +0000
committerGuy Harris <guy@alum.mit.edu>2000-11-19 03:47:36 +0000
commit4933cc340fe6e4d53eb8f1cd447080616bc72f83 (patch)
treea05660c64ec8ec13efb3259cb9df89693d13ddf0 /wiretap/i4btrace.c
parentea9409cb041dd2119b328e7848e4946afc654816 (diff)
downloadwireshark-4933cc340fe6e4d53eb8f1cd447080616bc72f83.tar.gz
"wtap_read()" must *always* set "*err" when it returns FALSE - if it's
just an EOF, it should set "*err" to 0. Fix up a bunch of read routines for various capture file types to set "*err" appropriately. svn path=/trunk/; revision=2667
Diffstat (limited to 'wiretap/i4btrace.c')
-rw-r--r--wiretap/i4btrace.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/wiretap/i4btrace.c b/wiretap/i4btrace.c
index 52f4fb53c7..736a211c6f 100644
--- a/wiretap/i4btrace.c
+++ b/wiretap/i4btrace.c
@@ -1,6 +1,6 @@
/* i4btrace.c
*
- * $Id: i4btrace.c,v 1.12 2000/11/17 21:00:40 gram Exp $
+ * $Id: i4btrace.c,v 1.13 2000/11/19 03:47:35 guy Exp $
*
* Wiretap Library
* Copyright (c) 1999 by Bert Driehuis <driehuis@playbeing.org>
@@ -130,9 +130,11 @@ static gboolean i4btrace_read(wtap *wth, int *err, int *data_offset)
}
wth->data_offset += sizeof hdr;
i4b_byte_swap_header(wth, &hdr);
- length = hdr.length - sizeof(hdr);
- if (length == 0)
+ if (hdr.length < sizeof(hdr)) {
+ *err = WTAP_ERR_BAD_RECORD; /* record length < header! */
return FALSE;
+ }
+ length = hdr.length - sizeof(hdr);
wth->phdr.len = length;
wth->phdr.caplen = length;