summaryrefslogtreecommitdiff
path: root/apps/plugins/lua
diff options
context:
space:
mode:
authorMaurus Cuelenaere <mcuelenaere@gmail.com>2009-07-15 15:16:55 +0000
committerMaurus Cuelenaere <mcuelenaere@gmail.com>2009-07-15 15:16:55 +0000
commitbe54b7f6a2312a007814284b3ae48ed5da892704 (patch)
tree51caa35b57958a47e631b181529ef9c5f9226476 /apps/plugins/lua
parent0e5942ffea44b3f95c0c3674882acf8c6f200dc2 (diff)
Revert r21863 partly: fixes Lua
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21883 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/lua')
-rw-r--r--apps/plugins/lua/lobject.c3
-rw-r--r--apps/plugins/lua/lstrlib.c4
-rw-r--r--apps/plugins/lua/rockconf.h1
3 files changed, 5 insertions, 3 deletions
diff --git a/apps/plugins/lua/lobject.c b/apps/plugins/lua/lobject.c
index 7f73114303..62ad8e9359 100644
--- a/apps/plugins/lua/lobject.c
+++ b/apps/plugins/lua/lobject.c
@@ -181,7 +181,8 @@ const char *luaO_pushfstring (lua_State *L, const char *fmt, ...) {
void luaO_chunkid (char *out, const char *source, size_t bufflen) {
if (*source == '=') {
- strlcpy(out, source+1, bufflen); /* remove first char */
+ strncpy(out, source+1, bufflen); /* remove first char */
+ out[bufflen-1] = '\0'; /* ensures null termination */
}
else { /* out = "source", or "...source" */
if (*source == '@') {
diff --git a/apps/plugins/lua/lstrlib.c b/apps/plugins/lua/lstrlib.c
index 4d58280ba8..3d6103692f 100644
--- a/apps/plugins/lua/lstrlib.c
+++ b/apps/plugins/lua/lstrlib.c
@@ -737,7 +737,9 @@ static const char *scanformat (lua_State *L, const char *strfrmt, char *form) {
if (isdigit(uchar(*p)))
luaL_error(L, "invalid format (width or precision too long)");
*(form++) = '%';
- strlcpy(form, strfrmt, p - strfrmt + 1);
+ strncpy(form, strfrmt, p - strfrmt + 1);
+ form += p - strfrmt + 1;
+ *form = '\0';
return p;
}
diff --git a/apps/plugins/lua/rockconf.h b/apps/plugins/lua/rockconf.h
index 02bd0e76d1..92c0f8cac8 100644
--- a/apps/plugins/lua/rockconf.h
+++ b/apps/plugins/lua/rockconf.h
@@ -63,7 +63,6 @@ long pow(long x, long y);
#define strchr rb->strchr
#define strcmp rb->strcmp
#define strcpy rb->strcpy
-#define strlcpy rb->strlcpy
#define strlen rb->strlen
#endif /* _ROCKCONF_H_ */