diff options
author | Joey Hess <joey@kitenet.net> | 2008-04-25 15:41:54 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2008-04-25 15:41:54 -0400 |
commit | 40ab45f59834317a4b2c67840530dfa10cc94529 (patch) | |
tree | e642fc83e7748cd67bf4775b7e19e1a15e8ecbde | |
parent | 2be74400b9dbb34615800bcd609c83ed85fc8df5 (diff) |
adventure: Fix crc code to not segfault on 64 bit architectures. Closes: #477768
-rw-r--r-- | adventure/crc.c | 4 | ||||
-rw-r--r-- | debian/changelog | 2 |
2 files changed, 5 insertions, 1 deletions
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 <limits.h> + #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 <joeyh@debian.org> Mon, 21 Apr 2008 12:37:44 -0400 |