summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2021-01-20 20:45:52 +0100
committerDaniel Friesel <derf@finalrewind.org>2021-01-20 20:45:52 +0100
commit1a8998393fea87e1ba8f672f0f1fbd540448e54f (patch)
treedc342b7e974864824537f39e17f7bd96cdb095c3 /src/lib
parentcb2f614cd8cea5a03d1e365a176f45e27a60faf8 (diff)
udeflate: Verify zlib FCHECK
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/udeflate.cc4
1 files changed, 4 insertions, 0 deletions
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);