Module: sip-router
Branch: 4.0
Commit: 9ee53f2abe580026c83d62b0edf1f6288dc0111a
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=9ee53f2…
Author: Vicente Hernando <vhernando(a)systemonenoc.com>
Committer: Vicente Hernando <vhernando(a)systemonenoc.com>
Date: Mon Jun 10 12:14:54 2013 +0200
app_lua: solve crash when setting a variable not convertible to string.
(cherry picked from commit 4af0bc13901525a5638c2c64b863f377e033903f)
---
modules/app_lua/app_lua_sr.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/modules/app_lua/app_lua_sr.c b/modules/app_lua/app_lua_sr.c
index b5a6a6c..21a9c18 100644
--- a/modules/app_lua/app_lua_sr.c
+++ b/modules/app_lua/app_lua_sr.c
@@ -989,6 +989,14 @@ static int lua_sr_pv_sets (lua_State *L)
LM_ERR("to few parameters [%d]\n",lua_gettop(L));
return 0;
}
+
+ if(!lua_isstring(L, -1))
+ {
+ LM_ERR("Cannot convert to a string when assigning value to variable: %s\n",
+ lua_tostring(L, -2));
+ return 0;
+ }
+
memset(&val, 0, sizeof(pv_value_t));
val.rs.s = (char*)lua_tostring(L, -1);
val.rs.len = strlen(val.rs.s);