From 40ab45f59834317a4b2c67840530dfa10cc94529 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 25 Apr 2008 15:41:54 -0400 Subject: [PATCH] adventure: Fix crc code to not segfault on 64 bit architectures. Closes: #477768 --- adventure/crc.c | 4 +++- debian/changelog | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/adventure/crc.c b/adventure/crc.c index 66504f1..c6ee5f1 100644 --- a/adventure/crc.c +++ b/adventure/crc.c @@ -42,6 +42,8 @@ __RCSID("$NetBSD: crc.c,v 1.8 2003/08/07 09:36:50 agc Exp $"); #endif #endif /* not lint */ +#include + #include "extern.h" const unsigned long crctab[] = { @@ -125,7 +127,7 @@ crc(ptr, nr) /* Process nr bytes at a time; ptr points to them */ while (nr > 0) for (p = ptr; nr--; ++p) { - if (!(i = crcval >> 24 ^ *p)) { + if (!(i = crcval >> (sizeof(crcval) * CHAR_BIT - 8) ^ *p)) { i = step++; if (step >= sizeof(crctab) / sizeof(crctab[0])) step = 0; diff --git a/debian/changelog b/debian/changelog index 28b511b..479afa7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,8 @@ bsdgames (2.17-15) UNRELEASED; urgency=low * Include rot13 in package description. Closes: #477141 + * adventure: Fix crc code to not segfault on 64 bit architectures. + Closes: #477768 -- Joey Hess Mon, 21 Apr 2008 12:37:44 -0400