From 86cb47dd6bee27d86d904fcd427957a04dad2408 Mon Sep 17 00:00:00 2001 From: nhmall Date: Thu, 23 Jul 2026 10:01:55 -0400 Subject: [PATCH] address a warning in cmd.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit cmd.c: In function ‘dokeylist’: cmd.c:2961:23: warning: ‘]’ directive writing 1 byte into a region of size between 0 and 255 [-Wformat-overflow=] 2961 | Sprintf(buf2, "[%s]", key2txt(key, buf)); | ^ --- src/cmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd.c b/src/cmd.c index 978e500b0..6f67db776 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -2957,7 +2957,7 @@ dokeylist(void) Sprintf(buf, "%-7s", key2txt(key, buf2)); #else /* first of the keyless commands */ - Sprintf(buf2, "[%s]", key2txt(key, buf)); + Snprintf(buf2, sizeof buf2, "[%s]", key2txt(key, buf)); Sprintf(buf, "%-21s", buf2); #endif Strcat(buf, " interrupt: break out of NetHack (SIGINT)");