diff --git a/src/output-lua.c b/src/output-lua.c index 3d083e57d3..39b7ea9c0f 100644 --- a/src/output-lua.c +++ b/src/output-lua.c @@ -757,7 +757,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);