[sr-dev] git:master:8d3d43c9: app_lua: safety check for anchor lump in old api hdr insert

Daniel-Constantin Mierla miconda at gmail.com
Wed Apr 17 15:43:54 CEST 2019


Module: kamailio
Branch: master
Commit: 8d3d43c9d8f768894e7ed89b17eca5be8d181b53
URL: https://github.com/kamailio/kamailio/commit/8d3d43c9d8f768894e7ed89b17eca5be8d181b53

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at 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/8d3d43c9d8f768894e7ed89b17eca5be8d181b53.diff
Patch: https://github.com/kamailio/kamailio/commit/8d3d43c9d8f768894e7ed89b17eca5be8d181b53.patch

---

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);




More information about the sr-dev mailing list