From b4acc03e65cb5cf76f66084a0ff93ac25597658c Mon Sep 17 00:00:00 2001 From: cojocar Date: Thu, 14 Nov 2013 11:12:58 +0100 Subject: [PATCH] crc_be: bugfix: use only the last two bytes to index crc_table --- crc32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crc32.c b/crc32.c index 865917c..0016db7 100644 --- a/crc32.c +++ b/crc32.c @@ -42,7 +42,7 @@ void crc_fill_table(ulong *table, int big, ulong polynomial) void crc_be_cycle(ulong *table, ulong *remainder, char c) { - ulong byte = table[((*remainder) >> 24) ^ c]; + ulong byte = table[(((*remainder) >> 24) ^ c) & 0xff]; *remainder = (((*remainder) << 8) ^ byte) & 0xFFFFFFFF; }