From d1ec1e85f8ff7800843952b69a196f0fa4e58f0e Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Wed, 8 Oct 2014 15:48:37 -0700 Subject: Use WTAP_ERR_DECOMPRESS for decompression errors. Distringuish "the compression data has a problem" from "the capture file (not compressed, or after decompression) data has a problem", with WTAP_ERR_DECOMPRESS used for the former (whether it's the gzipping decoded by our gunzip code or the Sniffer compression) and WTAP_ERR_BAD_FILE used for the latter. Change-Id: I8e6bff7edb480deba00c52a9e5afff607492e085 Reviewed-on: https://code.wireshark.org/review/4568 Reviewed-by: Guy Harris --- wiretap/ngsniffer.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wiretap/ngsniffer.c b/wiretap/ngsniffer.c index ce6fd45676..df4b30cc6e 100644 --- a/wiretap/ngsniffer.c +++ b/wiretap/ngsniffer.c @@ -2180,7 +2180,7 @@ ngsniffer_dump_close(wtap_dumper *wdh, int *err) record at the end. outlen - length of outbuf. err - return error code here - err_info - for WTAP_ERR_BAD_FILE, return descriptive string here + err_info - for WTAP_ERR_DECOMPRESS, return descriptive string here Return value is the number of bytes in outbuf on return. */ @@ -2192,7 +2192,7 @@ ngsniffer_dump_close(wtap_dumper *wdh, int *err) #define CHECK_INPUT_POINTER( length ) \ if ( pin + (length - 1) >= pin_end ) \ { \ - *err = WTAP_ERR_BAD_FILE; \ + *err = WTAP_ERR_DECOMPRESS; \ *err_info = g_strdup("ngsniffer: Compressed data item goes past the end of the compressed block"); \ return ( -1 ); \ } @@ -2243,14 +2243,14 @@ ngsniffer_dump_close(wtap_dumper *wdh, int *err) /* Check if offset would put us back past begin of buffer */ \ if ( pout - offset < outbuf ) \ { \ - *err = WTAP_ERR_BAD_FILE; \ + *err = WTAP_ERR_DECOMPRESS; \ *err_info = g_strdup("ngsniffer: LZ77 compressed data has bad offset to string"); \ return ( -1 ); \ } \ /* Check if offset would cause us to copy on top of ourselves */ \ if ( pout - offset + length > pout ) \ { \ - *err = WTAP_ERR_BAD_FILE; \ + *err = WTAP_ERR_DECOMPRESS; \ *err_info = g_strdup("ngsniffer: LZ77 compressed data has bad offset to string"); \ return ( -1 ); \ } \ -- cgit v1.2.3