From eb2052e9286ec6e2923dceaacdfe9aa58ecaedf8 Mon Sep 17 00:00:00 2001 From: espie Date: Mon, 16 Aug 2004 14:58:48 +0000 Subject: [PATCH] fix out of bounds access. thx tdeval@ for mmap malloc. okay naddy@ --- games/gnushogi/patches/patch-src_init_c | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 games/gnushogi/patches/patch-src_init_c diff --git a/games/gnushogi/patches/patch-src_init_c b/games/gnushogi/patches/patch-src_init_c new file mode 100644 index 00000000000..2d4c1e294df --- /dev/null +++ b/games/gnushogi/patches/patch-src_init_c @@ -0,0 +1,12 @@ +$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 +