From: Philippe Antoine Date: Thu, 29 Apr 2021 09:57:15 +0000 (+0200) Subject: swf: right input length for decompression X-Git-Tag: suricata-6.0.3~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a3f48480f032e57a0721787e3205d93abd72237a;p=thirdparty%2Fsuricata.git swf: right input length for decompression (cherry picked from commit 4d2f9cc8a0409bb03f5d285bb83d64afec08ba2a) --- diff --git a/src/util-file-decompression.c b/src/util-file-decompression.c index 9009845a10..f7b5d00b02 100644 --- a/src/util-file-decompression.c +++ b/src/util-file-decompression.c @@ -97,12 +97,10 @@ int FileSwfDecompression(const uint8_t *buffer, uint32_t buffer_len, } uint32_t compressed_data_len = 0; - if (buffer_len > offset && compress_depth == 0) { - compressed_data_len = buffer_len - offset; - } else if (compress_depth > 0 && compress_depth <= buffer_len) { + if (compress_depth > 0 && compress_depth <= buffer_len) { compressed_data_len = compress_depth; - } else if (compress_depth > 0 && compress_depth > buffer_len) { - compressed_data_len = buffer_len; + } else { + compressed_data_len = buffer_len - offset; } /* get swf version */