From 1a8998393fea87e1ba8f672f0f1fbd540448e54f Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 20 Jan 2021 20:45:52 +0100 Subject: udeflate: Verify zlib FCHECK --- src/lib/udeflate.cc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/lib') diff --git a/src/lib/udeflate.cc b/src/lib/udeflate.cc index baab208..5cd7973 100644 --- a/src/lib/udeflate.cc +++ b/src/lib/udeflate.cc @@ -422,6 +422,10 @@ int8_t udeflate_zlib(unsigned char *input_buf, uint16_t input_len, return UDEFLATE_ERR_FDICT; } + if ((((uint16_t)input_buf[0] << 8) | input_buf[1]) % 31) { + return UDEFLATE_ERR_FCHECK; + } + uint8_t ret = udeflate(input_buf + 2, input_len - 2, output_buf, output_len); -- cgit v1.2.3