From 2f7b2025309d63a0c732b537203f2036c0c34c0c Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 17 Sep 2022 19:29:09 -0400 Subject: [PATCH] avoid a format-overflow warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit options.c: In function ‘option_help’: options.c:8820:55: warning: ‘%s’ directive writing up to 255 bytes into a region of size 220 [-Wformat-overflow=] 8820 | Sprintf(buf, "Set options as OPTIONS= in %s", configfile); | ^~ ~~~~~~~~~~ --- src/options.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/options.c b/src/options.c index 526244e93..e3459f36c 100644 --- a/src/options.c +++ b/src/options.c @@ -8817,7 +8817,8 @@ option_help(void) winid datawin; datawin = create_nhwindow(NHW_TEXT); - Sprintf(buf, "Set options as OPTIONS= in %s", configfile); + Snprintf(buf, sizeof buf, + "Set options as OPTIONS= in %s", configfile); opt_intro[CONFIG_SLOT] = (const char *) buf; for (i = 0; opt_intro[i]; i++) putstr(datawin, 0, opt_intro[i]);