Skip to content

Commit

Permalink
decompressor: only take erroneous data on first try
Browse files Browse the repository at this point in the history
Ticket: 6959

We want to accept partial decompressed data with error, but only
if it is our first try, as we also want to try different
decompression algorithms if the first one does not match.

This led to use tolerating deflate which decompressed cleartext.
  • Loading branch information
catenacyber authored and victorjulien committed Apr 18, 2024
1 parent f50b390 commit f8f4164
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion htp/htp_decompressors.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ htp_status_t htp_gzip_decompressor_decompress(htp_decompressor_t *drec1, htp_tx_
return HTP_ERROR;
}
if (GZIP_BUF_SIZE > drec->stream.avail_out) {
if (rc == Z_DATA_ERROR) {
if (rc == Z_DATA_ERROR && drec->restart == 0) {
// There is data even if there is an error
// So use this data and log a warning
htp_log(d->tx->connp, HTP_LOG_MARK, HTP_LOG_WARNING, 0, "GZip decompressor: inflate failed with %d", rc);
Expand Down

0 comments on commit f8f4164

Please sign in to comment.