adventure: Fix crc code to not segfault on 64 bit architectures. Closes: #477768

This commit is contained in:
Joey Hess
2008-04-25 15:41:54 -04:00
parent 2be74400b9
commit 40ab45f598
2 changed files with 5 additions and 1 deletions

View File

@@ -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;

2
debian/changelog vendored
View File

@@ -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