From 1855b68af3ee365f871090c840f728691dd687de Mon Sep 17 00:00:00 2001 From: OpenGnSys Support Team Date: Thu, 6 Aug 2020 10:42:25 +0200 Subject: #980 fix compile warning in og_set_client_mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CC src/rest.o src/rest.c: In function ‘og_cmd_post_modes.isra.27’: src/rest.c:966:4: warning: ‘%s’ directive output may be truncated writing up to 4096 bytes into a region of size between 3018 and 4041 -Wformat-truncation=] "MODE_FILE='%s'\nMAC='%s'\nDATA='%s'\n" ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/rest.c:1085:7: template_name, scope_name); ~~~~~~~~~~~~~ src/rest.c:967:33: note: format string is defined here "MODE='PERM'\nTEMPLATE_NAME='%s'", ^~ src/rest.c:965:2: note: ‘snprintf’ output 57 or more bytes (assuming 5176) into a destination of size 4096 snprintf(cmd_params, sizeof(cmd_params), ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "MODE_FILE='%s'\nMAC='%s'\nDATA='%s'\n" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "MODE='PERM'\nTEMPLATE_NAME='%s'", ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mode, mac, params, template_name); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- src/rest.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/rest.c b/src/rest.c index ec6ca63..2256788 100644 --- a/src/rest.c +++ b/src/rest.c @@ -936,8 +936,8 @@ static int og_set_client_mode(struct og_dbi *dbi, const char *mac, const char *scope_name) { char filename[PATH_MAX + 1] = "/tmp/mode_params_XXXXXX"; - char cmd_params[PATH_MAX + 1] = {}; - char params[PATH_MAX + 1] = "\0"; + char cmd_params[16384] = {}; + char params[4096] = "\0"; const char *msglog; dbi_result result; unsigned int i; -- cgit v1.2.3-18-g5258