[sr-dev] git:master:47818cfa: app_lua: safety check for kemi func params used in log message
Daniel-Constantin Mierla
miconda at gmail.com
Sat Jul 1 09:11:39 CEST 2017
Module: kamailio
Branch: master
Commit: 47818cfab2db8ae1df720e959084e7afc22b7876
URL: https://github.com/kamailio/kamailio/commit/47818cfab2db8ae1df720e959084e7afc22b7876
Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2017-07-01T09:11:12+02:00
app_lua: safety check for kemi func params used in log message
- incresed size for local buffers
---
Modified: src/modules/app_lua/app_lua_mod.c
---
Diff: https://github.com/kamailio/kamailio/commit/47818cfab2db8ae1df720e959084e7afc22b7876.diff
Patch: https://github.com/kamailio/kamailio/commit/47818cfab2db8ae1df720e959084e7afc22b7876.patch
---
diff --git a/src/modules/app_lua/app_lua_mod.c b/src/modules/app_lua/app_lua_mod.c
index 05ea90c564..4c431dd3ed 100644
--- a/src/modules/app_lua/app_lua_mod.c
+++ b/src/modules/app_lua/app_lua_mod.c
@@ -207,15 +207,16 @@ static void mod_destroy(void)
lua_sr_destroy();
}
-static char _lua_buf_stack[4][512];
+#define LUA_BUF_STACK_SIZE 1024
+static char _lua_buf_stack[4][LUA_BUF_STACK_SIZE];
/**
*
*/
static int ki_app_lua_dostring(sip_msg_t *msg, str *script)
{
- if(script==NULL || script->s==NULL || script->len>=511) {
- LM_ERR("script too short or too long %d\n", script->len);
+ if(script==NULL || script->s==NULL || script->len>=LUA_BUF_STACK_SIZE-1) {
+ LM_ERR("script too short or too long %d\n", (script)?script->len:0);
return -1;
}
if(!lua_sr_initialized()) {
@@ -247,8 +248,8 @@ static int w_app_lua_dostring(struct sip_msg *msg, char *script, char *extra)
*/
static int ki_app_lua_dofile(sip_msg_t *msg, str *script)
{
- if(script==NULL || script->s==NULL || script->len>=511) {
- LM_ERR("script too short or too long %d\n", script->len);
+ if(script==NULL || script->s==NULL || script->len>=LUA_BUF_STACK_SIZE-1) {
+ LM_ERR("script too short or too long %d\n", (script)?script->len:0);
return -1;
}
if(!lua_sr_initialized()) {
@@ -278,8 +279,8 @@ static int w_app_lua_dofile(struct sip_msg *msg, char *script, char *extra)
*/
static int ki_app_lua_runstring(sip_msg_t *msg, str *script)
{
- if(script==NULL || script->s==NULL || script->len>=511) {
- LM_ERR("script too short or too long %d\n", script->len);
+ if(script==NULL || script->s==NULL || script->len>=LUA_BUF_STACK_SIZE-1) {
+ LM_ERR("script too short or too long %d\n", (script)?script->len:0);
return -1;
}
if(!lua_sr_initialized())
@@ -328,7 +329,7 @@ static int w_app_lua_run(struct sip_msg *msg, char *func, char *p1, char *p2,
LM_ERR("cannot get the function\n");
return -1;
}
- if(s.len>=511)
+ if(s.len>=LUA_BUF_STACK_SIZE-1)
{
LM_ERR("function too long %d\n", s.len);
return -1;
@@ -343,7 +344,7 @@ static int w_app_lua_run(struct sip_msg *msg, char *func, char *p1, char *p2,
LM_ERR("cannot get p1\n");
return -1;
}
- if(s.len>=511)
+ if(s.len>=LUA_BUF_STACK_SIZE-1)
{
LM_ERR("p1 too long %d\n", s.len);
return -1;
@@ -358,7 +359,7 @@ static int w_app_lua_run(struct sip_msg *msg, char *func, char *p1, char *p2,
LM_ERR("cannot get p2\n");
return -1;
}
- if(s.len>=511)
+ if(s.len>=LUA_BUF_STACK_SIZE-1)
{
LM_ERR("p2 too long %d\n", s.len);
return -1;
@@ -373,7 +374,7 @@ static int w_app_lua_run(struct sip_msg *msg, char *func, char *p1, char *p2,
LM_ERR("cannot get p3\n");
return -1;
}
- if(s.len>=511)
+ if(s.len>=LUA_BUF_STACK_SIZE-1)
{
LM_ERR("p3 too long %d\n", s.len);
return -1;
More information about the sr-dev
mailing list