fix two reported warnings with SERVER_ADMIN_MSG defined

Report stated a -Wformat-nonliteral at line 612,
and a -Wformat-security at line 614

I was only seeing the latter, so I added the former to the
flags in sys/unix/hints/include/compiler.370. Some compiler
versions have that warning on by default internally and others
don't. If the format string isn't a string literal, there's no
inteference with printf argument checking because that only
operates on string literals.
This commit is contained in:
nhmall
2022-02-07 09:16:31 -05:00
parent bbd5577063
commit 96c71660c6
2 changed files with 8 additions and 1 deletions

View File

@@ -559,6 +559,9 @@ ckmailstatus(void)
}
#if defined(SIMPLE_MAIL) || defined(SERVER_ADMIN_MSG)
DISABLE_WARNING_FORMAT_NONLITERAL
void
read_simplemail(char *mbox, boolean adminmsg)
{
@@ -611,7 +614,7 @@ read_simplemail(char *mbox, boolean adminmsg)
pline(msgfrom, curline);
if (adminmsg)
verbalize(msg);
verbalize("%s", msg);
else
pline("It reads: \"%s\".", msg);
@@ -642,6 +645,9 @@ read_simplemail(char *mbox, boolean adminmsg)
if (!adminmsg)
pline("It appears to be all gibberish.");
}
RESTORE_WARNING_FORMAT_NONLITERAL
#endif /* SIMPLE_MAIL */
void

View File

@@ -56,6 +56,7 @@ CFLAGS+=-Wall -Wextra -Wno-missing-field-initializers \
CFLAGS+=-pedantic
CFLAGS+=-Wmissing-declarations
CFLAGS+=-Wunreachable-code
CFLAGS+=-Wformat-nonliteral
#
# the following are not allowed in C++
CFLAGS+=-Wimplicit