address a warning in cmd.c

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));
      |                       ^
This commit is contained in:
nhmall
2026-07-23 10:01:55 -04:00
parent d6da7e9819
commit 86cb47dd6b
+1 -1
View File
@@ -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)");