[sr-dev] git:5.2:50296edb: core: don't abort() Kamailio in case of invalid lump parameters, return an error

Henning Westerholt hw at skalatan.de
Thu Apr 11 09:23:49 CEST 2019


Module: kamailio
Branch: 5.2
Commit: 50296edbd3a546a00bf3f0b14850bc003b22a360
URL: https://github.com/kamailio/kamailio/commit/50296edbd3a546a00bf3f0b14850bc003b22a360

Author: Henning Westerholt <hw at skalatan.de>
Committer: Henning Westerholt <hw at skalatan.de>
Date: 2019-04-11T09:23:26+02:00

core: don't abort() Kamailio in case of invalid lump parameters, return an error

(cherry picked from commit 853f65454d1a77b0145e80b006699fa1048045ac)

---

Modified: src/core/data_lump.c

---

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

---

diff --git a/src/core/data_lump.c b/src/core/data_lump.c
index e033b4e794..bb181ef2d9 100644
--- a/src/core/data_lump.c
+++ b/src/core/data_lump.c
@@ -288,14 +288,14 @@ struct lump* del_lump(struct sip_msg* msg, int offset, int len, enum _hdr_types_
 
 	/* extra checks */
 	if (offset>msg->len){
-		LM_CRIT("offset exceeds message size (%d > %d) aborting...\n",
+		LM_CRIT("offset exceeds message size (%d > %d)\n",
 					offset, msg->len);
-		abort();
+		return 0;
 	}
 	if (offset+len>msg->len){
 		LM_CRIT("offset + len exceeds message size (%d + %d > %d)\n",
 					offset, len,  msg->len);
-		abort();
+		return 0;
 	}
 	if (len==0){
 		LM_WARN("0 len (offset=%d)\n", offset);
@@ -344,9 +344,9 @@ struct lump* anchor_lump(struct sip_msg* msg, int offset, int len, enum _hdr_typ
 	
 	/* extra checks */
 	if (offset>msg->len){
-		LM_CRIT("offset exceeds message size (%d > %d) aborting...\n",
+		LM_CRIT("offset exceeds message size (%d > %d)\n",
 					offset, msg->len);
-		abort();
+		return 0;
 	}
 	if (len){
 		LM_WARN("len !=0 (%d)\n", len);
@@ -404,9 +404,9 @@ struct lump* anchor_lump2(struct sip_msg* msg, int offset, int len, enum _hdr_ty
 	
 	/* extra checks */
 	if (offset>msg->len){
-		LM_CRIT("offset exceeds message size (%d > %d) aborting...\n",
+		LM_CRIT("offset exceeds message size (%d > %d)\n",
 					offset, msg->len);
-		abort();
+		return 0;
 	}
 	if (len){
 		LM_WARN("len !=0 (%d)\n", len);




More information about the sr-dev mailing list