From: Victor Julien Date: Fri, 14 Jul 2017 09:05:51 +0000 (+0200) Subject: gcc7: format-truncation fix for lua X-Git-Tag: suricata-4.0.0~30 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=74f4f6dd633e53e7507399b715d07c264d96261f;p=thirdparty%2Fsuricata.git gcc7: format-truncation fix for lua --- diff --git a/src/output-lua.c b/src/output-lua.c index 55e9110570..6d7d7a07b7 100644 --- a/src/output-lua.c +++ b/src/output-lua.c @@ -689,7 +689,11 @@ static OutputCtx *OutputLuaLogInitSub(ConfNode *conf, OutputCtx *parent_ctx) } char path[PATH_MAX] = ""; - snprintf(path, sizeof(path),"%s%s%s", dir, strlen(dir) ? "/" : "", conf->val); + int ret = snprintf(path, sizeof(path),"%s%s%s", dir, strlen(dir) ? "/" : "", conf->val); + if (ret < 0 || ret == sizeof(path)) { + SCLogError(SC_ERR_SPRINTF,"failed to construct lua script path"); + goto error; + } SCLogDebug("script full path %s", path); SCMutexLock(&lua_ctx->m);