From 3cd47bb8fa6e29edc939886324822e9cf3d71955 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Wed, 11 Nov 2015 15:36:57 +0100 Subject: [PATCH] CID 22503 Negative array index write github issue #387 I was pretty sure I had submitted this before. What is going on? --- src/summary.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/summary.c b/src/summary.c index 4b7e037a8..94ae0b6e7 100644 --- a/src/summary.c +++ b/src/summary.c @@ -374,7 +374,10 @@ summary *make_summary(void) s->factions++; /* Problem mit Monsterpartei ... */ if (!is_monsters(f)) { - s->factionrace[old_race(f->race)]++; + int rc = old_race(f->race); + if (rc >= 0) { + s->factionrace[rc]++; + } } } }