fix #K4043 and #K4044 - out of bounds of races[]

character_race() was going out of bounds when scanning the races[]
array, relying on a field value that the fencepost entry didn't set.

This incorporates the previous fix for UNDEFINED_RACE but also changes
character_race() to not care about that anymore.
This commit is contained in:
PatR
2023-11-27 16:43:44 -08:00
parent 8a5ca6f64c
commit 75104c69ab
3 changed files with 46 additions and 36 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 decl.c $NHDT-Date: 1698264780 2023/10/25 20:13:00 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.293 $ */
/* NetHack 3.7 decl.c $NHDT-Date: 1701132220 2023/11/28 00:43:40 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.304 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2009. */
/* NetHack may be freely redistributed. See license for details. */
@@ -829,7 +829,7 @@ const struct instance_globals_u g_init_u = {
FALSE, /* unweapon */
/* role.c */
UNDEFINED_ROLE, /* urole */
UNDEFINED_VALUES, /* urace */
UNDEFINED_RACE, /* urace */
/* save.c */
{ 0, 0 }, /* uz_save */
TRUE, /* havestate*/