lua: snprintf include trailing \0 in size
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
dcbd7a7c14
commit
5bb2277ef2
6
lua.c
6
lua.c
|
@ -660,7 +660,7 @@ luaA_parserc(const char *confpatharg)
|
||||||
confpath = p_new(char, len);
|
confpath = p_new(char, len);
|
||||||
a_strcpy(confpath, len, confdir);
|
a_strcpy(confpath, len, confdir);
|
||||||
/* update package.path */
|
/* update package.path */
|
||||||
snprintf(path, sizeof(path) - 1, "package.path = package.path .. \";%s/awesome/?.lua\"", confdir);
|
snprintf(path, sizeof(path), "package.path = package.path .. \";%s/awesome/?.lua\"", confdir);
|
||||||
luaA_dostring(globalconf.L, path);
|
luaA_dostring(globalconf.L, path);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -671,7 +671,7 @@ luaA_parserc(const char *confpatharg)
|
||||||
a_strcpy(confpath, len, confdir);
|
a_strcpy(confpath, len, confdir);
|
||||||
a_strcat(confpath, len, XDG_CONFIG_HOME_DEFAULT);
|
a_strcat(confpath, len, XDG_CONFIG_HOME_DEFAULT);
|
||||||
/* update package.path */
|
/* update package.path */
|
||||||
snprintf(path, sizeof(path) - 1, "package.path = package.path .. \";%s" XDG_CONFIG_HOME_DEFAULT "/awesome/?.lua\"", confdir);
|
snprintf(path, sizeof(path), "package.path = package.path .. \";%s" XDG_CONFIG_HOME_DEFAULT "/awesome/?.lua\"", confdir);
|
||||||
luaA_dostring(globalconf.L, path);
|
luaA_dostring(globalconf.L, path);
|
||||||
}
|
}
|
||||||
a_strcat(confpath, len, AWESOME_CONFIG_FILE);
|
a_strcat(confpath, len, AWESOME_CONFIG_FILE);
|
||||||
|
@ -698,7 +698,7 @@ luaA_parserc(const char *confpatharg)
|
||||||
confpath = p_new(char, len);
|
confpath = p_new(char, len);
|
||||||
a_strcpy(confpath, len, *buf);
|
a_strcpy(confpath, len, *buf);
|
||||||
a_strcat(confpath, len, AWESOME_CONFIG_FILE);
|
a_strcat(confpath, len, AWESOME_CONFIG_FILE);
|
||||||
snprintf(path, sizeof(path) - 1, "package.path = package.path .. \";%s/awesome/?.lua\"", *buf);
|
snprintf(path, sizeof(path), "package.path = package.path .. \";%s/awesome/?.lua\"", *buf);
|
||||||
luaA_dostring(globalconf.L, path);
|
luaA_dostring(globalconf.L, path);
|
||||||
if(luaL_dofile(globalconf.L, confpath))
|
if(luaL_dofile(globalconf.L, confpath))
|
||||||
fprintf(stderr, "%s\n", lua_tostring(globalconf.L, -1));
|
fprintf(stderr, "%s\n", lua_tostring(globalconf.L, -1));
|
||||||
|
|
Loading…
Reference in New Issue