diff options
Diffstat (limited to 'wiretap')
-rw-r--r-- | wiretap/ascend.c | 3 | ||||
-rw-r--r-- | wiretap/csids.c | 6 | ||||
-rw-r--r-- | wiretap/i4btrace.c | 8 | ||||
-rw-r--r-- | wiretap/netmon.c | 5 | ||||
-rw-r--r-- | wiretap/netxray.c | 3 | ||||
-rw-r--r-- | wiretap/ngsniffer.c | 3 | ||||
-rw-r--r-- | wiretap/pppdump.c | 5 | ||||
-rw-r--r-- | wiretap/toshiba.c | 3 |
8 files changed, 25 insertions, 11 deletions
diff --git a/wiretap/ascend.c b/wiretap/ascend.c index 5e0b3e29c5..7ce6897dd6 100644 --- a/wiretap/ascend.c +++ b/wiretap/ascend.c @@ -1,6 +1,6 @@ /* ascend.c * - * $Id: ascend.c,v 1.21 2000/11/12 08:45:28 guy Exp $ + * $Id: ascend.c,v 1.22 2000/11/19 03:47:35 guy Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org> @@ -257,6 +257,7 @@ static gboolean ascend_read(wtap *wth, int *err, int *data_offset) file_seek(wth->fh, wth->capture.ascend->next_packet_seek_start, SEEK_SET); offset = ascend_seek(wth, ASCEND_MAX_SEEK); if (offset == -1) { + *err = 0; /* XXX - assume, for now, that it's an EOF */ return FALSE; } if (! parse_ascend(wth->fh, buf, &wth->pseudo_header.ascend, &header, 0)) { diff --git a/wiretap/csids.c b/wiretap/csids.c index fbe2d946bd..01c30c8119 100644 --- a/wiretap/csids.c +++ b/wiretap/csids.c @@ -1,6 +1,6 @@ /* csids.c * - * $Id: csids.c,v 1.4 2000/09/07 05:34:07 gram Exp $ + * $Id: csids.c,v 1.5 2000/11/19 03:47:35 guy Exp $ * * Copyright (c) 2000 by Mike Hall <mlh@io.com> * Copyright (c) 2000 by Cisco Systems @@ -151,6 +151,8 @@ static gboolean csids_read(wtap *wth, int *err, int *data_offset) bytesRead = file_read( &hdr, 1, sizeof( struct csids_header) , wth->fh ); if( bytesRead != sizeof( struct csids_header) ) { *err = file_error( wth->fh ); + if (*err == 0 && bytesRead != 0) + *err = WTAP_ERR_SHORT_READ; return FALSE; } hdr.seconds = pntohl(&hdr.seconds); @@ -165,6 +167,8 @@ static gboolean csids_read(wtap *wth, int *err, int *data_offset) bytesRead = file_read( buf, 1, hdr.caplen, wth->fh ); if( bytesRead != hdr.caplen ) { *err = file_error( wth->fh ); + if (*err == 0) + *err = WTAP_ERR_SHORT_READ; return FALSE; } 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; diff --git a/wiretap/netmon.c b/wiretap/netmon.c index 7a56d7b3a4..00a03cc0e9 100644 --- a/wiretap/netmon.c +++ b/wiretap/netmon.c @@ -1,6 +1,6 @@ /* netmon.c * - * $Id: netmon.c,v 1.34 2000/09/21 04:41:32 gram Exp $ + * $Id: netmon.c,v 1.35 2000/11/19 03:47:35 guy Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org> @@ -298,7 +298,8 @@ static gboolean netmon_read(wtap *wth, int *err, int *data_offset) free it. */ g_free(wth->capture.netmon->frame_table); wth->capture.netmon->frame_table = NULL; - return 0; + *err = 0; /* it's just an EOF, not an error */ + return FALSE; } /* Seek to the beginning of the current record, if we're diff --git a/wiretap/netxray.c b/wiretap/netxray.c index 16123ecae6..447723802b 100644 --- a/wiretap/netxray.c +++ b/wiretap/netxray.c @@ -1,6 +1,6 @@ /* netxray.c * - * $Id: netxray.c,v 1.33 2000/09/23 05:58:26 guy Exp $ + * $Id: netxray.c,v 1.34 2000/11/19 03:47:35 guy Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org> @@ -234,6 +234,7 @@ reread: /* Have we reached the end of the packet data? */ if (wth->data_offset == wth->capture.netxray->end_offset) { /* Yes. */ + *err = 0; /* it's just an EOF, not an error */ return FALSE; } /* Read record header. */ diff --git a/wiretap/ngsniffer.c b/wiretap/ngsniffer.c index 5f8294c36a..a371cb82bc 100644 --- a/wiretap/ngsniffer.c +++ b/wiretap/ngsniffer.c @@ -1,6 +1,6 @@ /* ngsniffer.c * - * $Id: ngsniffer.c,v 1.54 2000/11/11 06:36:09 guy Exp $ + * $Id: ngsniffer.c,v 1.55 2000/11/19 03:47:36 guy Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org> @@ -687,6 +687,7 @@ static gboolean ngsniffer_read(wtap *wth, int *err, int *data_offset) /* * End of file. Return an EOF indication. */ + *err = 0; /* EOF, not error */ return FALSE; default: diff --git a/wiretap/pppdump.c b/wiretap/pppdump.c index c80ac81449..e6ea7e8075 100644 --- a/wiretap/pppdump.c +++ b/wiretap/pppdump.c @@ -1,6 +1,6 @@ /* pppdump.c * - * $Id: pppdump.c,v 1.4 2000/11/17 21:00:40 gram Exp $ + * $Id: pppdump.c,v 1.5 2000/11/19 03:47:36 guy Exp $ * * Copyright (c) 2000 by Gilbert Ramirez <gram@xiexie.org> * @@ -30,6 +30,7 @@ #include <glib.h> #include <stdio.h> #include <stdlib.h> +#include <errno.h> #include <string.h> /* @@ -232,6 +233,7 @@ pppdump_read(wtap *wth, int *err, int *data_offset) state = wth->capture.generic; pid = g_new(pkt_id, 1); if (!pid) { + *err = errno; /* assume a malloc failed and set "errno" */ return FALSE; } pid->offset = 0; @@ -337,6 +339,7 @@ process_data(pppdump_t *state, FILE_T fh, pkt_t *pkt, int n, guint8 *pd, int *er num_bytes--; if (num_bytes > 0) { if (!save_prec_state(state, num_bytes, pkt)) { + *err = errno; return -1; } *state_saved = TRUE; diff --git a/wiretap/toshiba.c b/wiretap/toshiba.c index d0b6d37c3f..de53d08bb6 100644 --- a/wiretap/toshiba.c +++ b/wiretap/toshiba.c @@ -1,6 +1,6 @@ /* toshiba.c * - * $Id: toshiba.c,v 1.13 2000/09/21 04:41:37 gram Exp $ + * $Id: toshiba.c,v 1.14 2000/11/19 03:47:36 guy Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org> @@ -209,6 +209,7 @@ static gboolean toshiba_read(wtap *wth, int *err, int *data_offset) /* Find the next packet */ offset = toshiba_seek_next_packet(wth); if (offset < 1) { + *err = 0; /* XXX - assume, for now, that it's an EOF */ return FALSE; } |