[sr-dev] git:master:375f86b6: posops: safety check for change anchor

Daniel-Constantin Mierla miconda at gmail.com
Fri Oct 29 13:28:45 CEST 2021


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2021-10-29T13:28:07+02:00

posops: safety check for change anchor

---

Modified: src/modules/posops/posops_mod.c

---

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

---

diff --git a/src/modules/posops/posops_mod.c b/src/modules/posops/posops_mod.c
index 5710b83da2..465d6490ed 100644
--- a/src/modules/posops/posops_mod.c
+++ b/src/modules/posops/posops_mod.c
@@ -186,6 +186,10 @@ static int ki_posops_pos_append(sip_msg_t *msg, int idx, str *val)
 	}
 
 	anchor = anchor_lump(msg, offset, 0, 0);
+	if(anchor == NULL) {
+		LM_ERR("failed to create the anchor\n");
+		return -1;
+	}
 	if (insert_new_lump_after(anchor, val->s, val->len, 0) == 0) {
 		LM_ERR("unable to add lump\n");
 		return -1;
@@ -241,6 +245,10 @@ static int ki_posops_pos_insert(sip_msg_t *msg, int idx, str *val)
 	}
 
 	anchor = anchor_lump(msg, offset, 0, 0);
+	if(anchor == NULL) {
+		LM_ERR("failed to create the anchor\n");
+		return -1;
+	}
 	if (insert_new_lump_before(anchor, val->s, val->len, 0) == 0) {
 		LM_ERR("unable to add lump\n");
 		return -1;




More information about the sr-dev mailing list