]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
gcc7: format-truncation fix for lua
authorVictor Julien <victor@inliniac.net>
Fri, 14 Jul 2017 09:05:51 +0000 (11:05 +0200)
committerVictor Julien <victor@inliniac.net>
Fri, 14 Jul 2017 09:05:51 +0000 (11:05 +0200)
src/output-lua.c

index 55e9110570312424995f1568cd58e64f1f56248e..6d7d7a07b76d765f4e71098bba9bf22ded0610ff 100644 (file)
@@ -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);