[sr-dev] git:master:f109109a: app_lua: safety check of returned anchor before using it

Daniel-Constantin Mierla miconda at gmail.com
Fri Nov 4 09:50:53 CET 2016


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2016-11-04T09:49:50+01:00

app_lua: safety check of returned anchor before using it

---

Modified: modules/app_lua/app_lua_sr.c

---

Diff:  https://github.com/kamailio/kamailio/commit/f109109a194abcc105f6d6a2e398d28e21870941.diff
Patch: https://github.com/kamailio/kamailio/commit/f109109a194abcc105f6d6a2e398d28e21870941.patch

---

diff --git a/modules/app_lua/app_lua_sr.c b/modules/app_lua/app_lua_sr.c
index ba270f5..abfedfa 100644
--- a/modules/app_lua/app_lua_sr.c
+++ b/modules/app_lua/app_lua_sr.c
@@ -744,6 +744,12 @@ static int lua_sr_hdr_append (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(anchor==NULL)
+	{
+		LM_ERR("unable to get the anchor\n");
+		pkg_free(hdr);
+		return 0;
+	}
 	if(insert_new_lump_before(anchor, hdr, len, 0) == 0)
 	{
 		LM_ERR("can't insert lump\n");




More information about the sr-dev mailing list