warning fix

mhitm.c: In function 'hitmm':
mhitm.c:583:30: warning: '%s' directive writing between 8 and 9 bytes into a region of size between 0 and 255 [-Wformat-overflow=]
  583 |             Sprintf(buf, "%s %s", magr_name,
      |                              ^~
In file included from ../include/config.h:671,
                 from ../include/hack.h:10,
                 from mhitm.c:6:
../include/global.h:279:24: note: 'sprintf' output between 10 and 266 bytes into a destination of size 256
  279 | #define Sprintf (void) sprintf
mhitm.c:583:13: note: in expansion of macro 'Sprintf'
  583 |             Sprintf(buf, "%s %s", magr_name,
      |             ^~~~~~~
This commit is contained in:
nhmall
2022-10-24 09:14:35 -04:00
parent 027cf3bf4d
commit e2bd3b6b55

View File

@@ -580,7 +580,7 @@ hitmm(
Strcpy(magr_name, Monnam(magr));
if (compat) {
Sprintf(buf, "%s %s", magr_name,
Snprintf(buf, sizeof buf, "%s %s", magr_name,
mdef->mcansee ? "smiles at" : "talks to");
pline("%s %s %s.", buf, mon_nam(mdef),
(compat == 2) ? "engagingly" : "seductively");