[sr-dev] git:master:5ce98491: app_mono: safety check for anchor lump

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


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2019-04-17T15:40:47+02:00

app_mono: safety check for anchor lump

---

Modified: src/modules/app_mono/app_mono_api.c

---

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

---

diff --git a/src/modules/app_mono/app_mono_api.c b/src/modules/app_mono/app_mono_api.c
index efd17e8226..2343b1d922 100644
--- a/src/modules/app_mono/app_mono_api.c
+++ b/src/modules/app_mono/app_mono_api.c
@@ -778,7 +778,7 @@ static int sr_mono_hdr_append (MonoString *hv)
 	hdr[txt.len] = '\0';
 	anchor = anchor_lump(env_M->msg,
 				hf->name.s + hf->len - env_M->msg->buf, 0, 0);
-	if(insert_new_lump_before(anchor, hdr, txt.len, 0) == 0)
+	if((anchor==NULL) || (insert_new_lump_before(anchor, hdr, txt.len, 0) == 0))
 	{
 		LM_ERR("can't insert lump\n");
 		pkg_free(hdr);
@@ -873,7 +873,7 @@ static int sr_mono_hdr_insert (MonoString *hv)
 	hdr[txt.len] = '\0';
 	anchor = anchor_lump(env_M->msg,
 				hf->name.s + hf->len - env_M->msg->buf, 0, 0);
-	if(insert_new_lump_before(anchor, hdr, txt.len, 0) == 0)
+	if((anchor==NULL) || (insert_new_lump_before(anchor, hdr, txt.len, 0) == 0))
 	{
 		LM_ERR("can't insert lump\n");
 		pkg_free(hdr);




More information about the sr-dev mailing list