From 2b2f949484a82bec0c0af0e4a0e080b0ac64d6e1 Mon Sep 17 00:00:00 2001 From: nhmall Date: Fri, 26 Jun 2026 15:11:42 -0400 Subject: [PATCH] address another warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sounds.c: In function ‘domonnoise’: sounds.c:818:40: warning: array subscript [0, 1] is outside array bounds of ‘const char * const[2]’ [-Warray-bounds=] 818 | verbl_msg = vampmsg[vampindex]; | ~~~~~~~^~~~~~~~~~~ sounds.c:786:38: note: while referencing ‘vampmsg’ 786 | static const char *const vampmsg[] = { | ^~~~~~~ --- src/sounds.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/sounds.c b/src/sounds.c index aedf619d7..4fcd1c9de 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -814,8 +814,10 @@ domonnoise(struct monst *mtmp) flags.female ? FEMALE : MALE)) : an(racenoun)); verbl_msg = verbuf; - } else - verbl_msg = vampmsg[vampindex]; + } else if (vampindex > 1) { + if (vampindex >= 0 && vampindex < SIZE(vampmsg)) + verbl_msg = vampmsg[vampindex]; + } } } break;