From 20c2595f2de956f70f164fa3b822989e178f0459 Mon Sep 17 00:00:00 2001
From: Přemysl Janouch
Date: Thu, 30 Aug 2012 04:36:15 +0200
Subject: Check symbol names in LdLua during registration.
---
liblogdiag/ld-lua.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/liblogdiag/ld-lua.c b/liblogdiag/ld-lua.c
index 18bf9ce..935c2a1 100644
--- a/liblogdiag/ld-lua.c
+++ b/liblogdiag/ld-lua.c
@@ -492,6 +492,7 @@ static int
process_registration (lua_State *L)
{
LdLuaSymbol *symbol;
+ const gchar *name;
gchar *human_name;
int i, type, types[] =
@@ -508,7 +509,10 @@ process_registration (lua_State *L)
lua_typename (L, types[i]), lua_typename (L, type));
symbol = LD_LUA_SYMBOL (lua_touserdata (L, lua_upvalueindex (1)));
- symbol->priv->name = g_strdup (lua_tostring (L, 1));
+ name = lua_tostring (L, 1);
+ if (g_strstr_len (name, -1, LD_LIBRARY_IDENTIFIER_SEPARATOR))
+ return luaL_error (L, "Invalid symbol name.");
+ symbol->priv->name = g_strdup (name);
human_name = get_translation (L, 2);
if (!human_name)
--
cgit v1.2.3-70-g09d2