diff options
-rw-r--r-- | include/lib/udeflate.h | 1 | ||||
-rw-r--r-- | src/lib/udeflate.cc | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/include/lib/udeflate.h b/include/lib/udeflate.h index f3b1ff6..5e07422 100644 --- a/include/lib/udeflate.h +++ b/include/lib/udeflate.h @@ -12,6 +12,7 @@ #define UDEFLATE_ERR_BLOCK (-4) #define UDEFLATE_ERR_CHECKSUM (-5) #define UDEFLATE_ERR_OUTPUT_LENGTH (-6) +#define UDEFLATE_ERR_FCHECK (-7) int8_t udeflate(unsigned char *input_buf, uint16_t input_len, unsigned char *output_buf, uint16_t output_len); 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); |