Module: kamailio
Branch: master
Commit: 84f7905e66fb72ebc382034d1e858d06f5c16057
URL:
https://github.com/kamailio/kamailio/commit/84f7905e66fb72ebc382034d1e858d0…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-07-01T09:11:12+02:00
app_jsdt: safety check for kemi func params used in log message
- incresed size for local buffers
---
Modified: src/modules/app_jsdt/app_jsdt_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/84f7905e66fb72ebc382034d1e858d0…
Patch:
https://github.com/kamailio/kamailio/commit/84f7905e66fb72ebc382034d1e858d0…
---
diff --git a/src/modules/app_jsdt/app_jsdt_mod.c b/src/modules/app_jsdt/app_jsdt_mod.c
index c95585d7d2..49f3670ff1 100644
--- a/src/modules/app_jsdt/app_jsdt_mod.c
+++ b/src/modules/app_jsdt/app_jsdt_mod.c
@@ -192,15 +192,16 @@ int sr_kemi_config_engine_jsdt(sip_msg_t *msg, int rtype, str
*rname,
return 1;
}
-static char _jsdt_buf_stack[4][512];
+#define JSDT_BUF_STACK_SIZE 1024
+static char _jsdt_buf_stack[4][JSDT_BUF_STACK_SIZE];
/**
*
*/
static int ki_app_jsdt_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>=JSDT_BUF_STACK_SIZE-1) {
+ LM_ERR("script too short or too long %d\n", (script)?script->len:0);
return -1;
}
if(!jsdt_sr_initialized())
@@ -232,8 +233,8 @@ static int w_app_jsdt_dostring(struct sip_msg *msg, char *script, char
*extra)
*/
static int ki_app_jsdt_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>=JSDT_BUF_STACK_SIZE-1) {
+ LM_ERR("script too short or too long %d\n", (script)?script->len:0);
return -1;
}
if(!jsdt_sr_initialized())
@@ -265,8 +266,8 @@ static int w_app_jsdt_dofile(struct sip_msg *msg, char *script, char
*extra)
*/
static int ki_app_jsdt_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>=JSDT_BUF_STACK_SIZE-1) {
+ LM_ERR("script too short or too long %d\n", (script)?script->len:0);
return -1;
}
if(!jsdt_sr_initialized())
@@ -310,7 +311,7 @@ static int w_app_jsdt_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>=JSDT_BUF_STACK_SIZE-1)
{
LM_ERR("function too long %d\n", s.len);
return -1;
@@ -325,7 +326,7 @@ static int w_app_jsdt_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>=JSDT_BUF_STACK_SIZE-1)
{
LM_ERR("p1 too long %d\n", s.len);
return -1;
@@ -340,7 +341,7 @@ static int w_app_jsdt_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>=JSDT_BUF_STACK_SIZE-1)
{
LM_ERR("p2 too long %d\n", s.len);
return -1;
@@ -355,7 +356,7 @@ static int w_app_jsdt_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>=JSDT_BUF_STACK_SIZE-1)
{
LM_ERR("p3 too long %d\n", s.len);
return -1;