aboutsummaryrefslogtreecommitdiffstats
path: root/src/cnki_zlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cnki_zlib.c')
-rw-r--r--src/cnki_zlib.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/cnki_zlib.c b/src/cnki_zlib.c
index edff141..075456b 100644
--- a/src/cnki_zlib.c
+++ b/src/cnki_zlib.c
@@ -13,12 +13,17 @@ int
cnki_zlib(char **dst, int *dst_size,
const char * restrict src, int src_size)
{
+ uint8_t padding = 0;
int32_t size;
- memcpy(&size, src + 20, 4);
+
+ if (strncmp(src + 8, "COMPRESSTEXT", 12) == 0)
+ padding = 8;
+
+ memcpy(&size, src + 12 + padding, 4);
*dst_size = size;
- if (strinflate(dst, size, src + 24, src_size - 24) != 0)
+ if (strinflate(dst, size, src + 16 + padding, src_size - 16 - padding) != 0)
return 1;
return 0;