From 5bb2277ef2f5600a715c5ff7f6d9e8f0b7d847dc Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Wed, 27 Aug 2008 17:15:47 +0200 Subject: [PATCH] lua: snprintf include trailing \0 in size Signed-off-by: Julien Danjou --- lua.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua.c b/lua.c index 5b5700f1..04257801 100644 --- a/lua.c +++ b/lua.c @@ -660,7 +660,7 @@ luaA_parserc(const char *confpatharg) confpath = p_new(char, len); a_strcpy(confpath, len, confdir); /* 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); } else @@ -671,7 +671,7 @@ luaA_parserc(const char *confpatharg) a_strcpy(confpath, len, confdir); a_strcat(confpath, len, XDG_CONFIG_HOME_DEFAULT); /* 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); } a_strcat(confpath, len, AWESOME_CONFIG_FILE); @@ -698,7 +698,7 @@ luaA_parserc(const char *confpatharg) confpath = p_new(char, len); a_strcpy(confpath, len, *buf); 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); if(luaL_dofile(globalconf.L, confpath)) fprintf(stderr, "%s\n", lua_tostring(globalconf.L, -1));