openbsd-ports/games/gnushogi/patches/patch-src_init_c
espie eb2052e928 fix out of bounds access.
thx tdeval@ for mmap malloc.
okay naddy@
2004-08-16 14:58:48 +00:00

13 lines
530 B
Plaintext

$OpenBSD: patch-src_init_c,v 1.1 2004/08/16 14:58:48 espie Exp $
--- src/init.c.orig Fri May 19 10:44:14 1995
+++ src/init.c Mon Aug 16 16:15:46 2004
@@ -225,7 +225,7 @@ short distance (short a, short b)
#else
short distance (short a, short b)
{
- return (use_distdata ? (short)(*distdata)[(int)a][(int)b] : (short)computed_distance(a,b));
+ return (use_distdata && a < NO_SQUARES && b < NO_SQUARES ? (short)(*distdata)[(int)a][(int)b] : (short)computed_distance(a,b));
}
#endif