From d94bd07f99438278cb11f24b00571ab2907b6bdb Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Tue, 13 Dec 2011 09:53:50 +0000 Subject: Rename WTAP_ERR_BAD_RECORD to WTAP_ERR_BAD_FILE; it really reports any form of corruption/bogosity in a file, including in a file header as well as in records in the file. Change the error message wtap_strerror() returns for it to reflect that. Use it for some file header problems for which it wasn't already being used - WTAP_ERR_UNSUPPORTED shouldn't be used for that, it should only be used for files that we have no reason to believe are invalid but that have a version number we don't know about or some other non-link-layer-encapsulation-type value we don't know about. svn path=/trunk/; revision=40175 --- wiretap/nettl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'wiretap/nettl.c') diff --git a/wiretap/nettl.c b/wiretap/nettl.c index e265b45da9..735fe9edf7 100644 --- a/wiretap/nettl.c +++ b/wiretap/nettl.c @@ -323,7 +323,7 @@ static gboolean nettl_read(wtap *wth, int *err, gchar **err_info, * Probably a corrupt capture file; don't blow up trying * to allocate space for an immensely-large packet. */ - *err = WTAP_ERR_BAD_RECORD; + *err = WTAP_ERR_BAD_FILE; *err_info = g_strdup_printf("nettl: File has %u-byte packet, bigger than maximum of %u", wth->phdr.caplen, WTAP_MAX_PACKET_SIZE); return FALSE; @@ -417,7 +417,7 @@ nettl_read_rec_header(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, offset += 2; hdr_len = g_ntohs(rec_hdr.hdr_len); if (hdr_len < NETTL_REC_HDR_LEN) { - *err = WTAP_ERR_BAD_RECORD; + *err = WTAP_ERR_BAD_FILE; *err_info = g_strdup_printf("nettl: record header length %u too short", hdr_len); return -1; @@ -635,14 +635,14 @@ nettl_read_rec_header(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, } if (length < padlen) { - *err = WTAP_ERR_BAD_RECORD; + *err = WTAP_ERR_BAD_FILE; *err_info = g_strdup_printf("nettl: packet length %u in record header too short, less than %u", length, padlen); return -1; } phdr->len = length - padlen; if (caplen < padlen) { - *err = WTAP_ERR_BAD_RECORD; + *err = WTAP_ERR_BAD_FILE; *err_info = g_strdup_printf("nettl: captured length %u in record header too short, less than %u", caplen, padlen); return -1; -- cgit v1.2.1