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 <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2014-10-08 15:48:37 -07:00
parent 0066776f72
commit d1ec1e85f8
1 changed files with 4 additions and 4 deletions

View File

@ -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 ); \
} \