commit 29f38bd: [Minor] Correct deflate header detection

Vsevolod Stakhov vsevolod at highsecure.ru
Mon Apr 13 14:42:06 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-04-13 15:41:28 +0100
URL: https://github.com/rspamd/rspamd/commit/29f38bde308faed44b6298338451fb7b82923c65 (HEAD -> master)

[Minor] Correct deflate header detection

---
 src/lua/lua_util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lua/lua_util.c b/src/lua/lua_util.c
index d89cfd28d..04413f2f6 100644
--- a/src/lua/lua_util.c
+++ b/src/lua/lua_util.c
@@ -2392,7 +2392,7 @@ lua_util_zlib_inflate (lua_State *L, int windowBits)
 
 	/* Here are dragons to distinguish between raw deflate and zlib */
 	if (windowBits == MAX_WBITS && t->len > 0) {
-		if ((int)(unsigned char)t->start[0] != 0x78) {
+		if ((int)(unsigned char)((t->start[0] << 4)) != 0x80) {
 			/* Assume raw deflate */
 			windowBits = -windowBits;
 		}


More information about the Commits mailing list