Skip to content

Commit

Permalink
app_lua: safer alloc size for hdr operations
Browse files Browse the repository at this point in the history
(cherry picked from commit 15de1f0)
  • Loading branch information
miconda committed Aug 30, 2017
1 parent d40268a commit d8f0d9e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/modules/app_lua/app_lua_sr.c
Expand Up @@ -737,7 +737,7 @@ static int lua_sr_hdr_append (lua_State *L)

hf = env_L->msg->last_header;
len = strlen(txt);
hdr = (char*)pkg_malloc(len);
hdr = (char*)pkg_malloc(len+1);
if(hdr==NULL)
{
LM_ERR("no pkg memory left\n");
Expand Down Expand Up @@ -823,7 +823,7 @@ static int lua_sr_hdr_insert (lua_State *L)
LM_DBG("insert hf: %s\n", txt);
hf = env_L->msg->headers;
len = strlen(txt);
hdr = (char*)pkg_malloc(len);
hdr = (char*)pkg_malloc(len+1);
if(hdr==NULL)
{
LM_ERR("no pkg memory left\n");
Expand Down Expand Up @@ -1683,7 +1683,6 @@ int sr_kemi_lua_exec_func_ex(lua_State* L, sr_kemi_t *ket, int pdelta)
fname->len, fname->s);
return app_lua_return_false(L);
}
return app_lua_return_false(L);
}

/**
Expand Down

0 comments on commit d8f0d9e

Please sign in to comment.