Module: kamailio Branch: master Commit: 8d3d43c9d8f768894e7ed89b17eca5be8d181b53 URL: https://github.com/kamailio/kamailio/commit/8d3d43c9d8f768894e7ed89b17eca5be...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2019-04-17T15:42:49+02:00
app_lua: safety check for anchor lump in old api hdr insert
---
Modified: src/modules/app_lua/app_lua_sr.c
---
Diff: https://github.com/kamailio/kamailio/commit/8d3d43c9d8f768894e7ed89b17eca5be... Patch: https://github.com/kamailio/kamailio/commit/8d3d43c9d8f768894e7ed89b17eca5be...
---
diff --git a/src/modules/app_lua/app_lua_sr.c b/src/modules/app_lua/app_lua_sr.c index 9334a67835..d30d73ef5a 100644 --- a/src/modules/app_lua/app_lua_sr.c +++ b/src/modules/app_lua/app_lua_sr.c @@ -835,7 +835,7 @@ static int lua_sr_hdr_insert (lua_State *L) memcpy(hdr, txt, len); anchor = anchor_lump(env_L->msg, hf->name.s + hf->len - env_L->msg->buf, 0, 0); - if(insert_new_lump_before(anchor, hdr, len, 0) == 0) + if((anchor==NULL) || (insert_new_lump_before(anchor, hdr, len, 0) == 0)) { LM_ERR("can't insert lump\n"); pkg_free(hdr);