[sr-dev] git:master:88b67575: tm: safety check not to allocate 0 bytes in rpc command

Daniel-Constantin Mierla miconda at gmail.com
Thu May 14 13:53:05 CEST 2015


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2015-05-14T13:40:11+02:00

tm: safety check not to allocate 0 bytes in rpc command

---

Modified: modules/tm/rpc_uac.c

---

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

---

diff --git a/modules/tm/rpc_uac.c b/modules/tm/rpc_uac.c
index 14c02f0..d223fd2 100644
--- a/modules/tm/rpc_uac.c
+++ b/modules/tm/rpc_uac.c
@@ -211,7 +211,12 @@ static char *get_hfblock(str *uri, struct hdr_field *hf, int proto,
 		DBG("get_hfblock: one more hf processed\n");
 	} /* header loop */
 	
-	     /* construct a single header block now */
+	if(total_len==0) {
+		LM_DBG("empty result for headers block\n");
+		goto error;
+	}
+
+	/* construct a single header block now */
 	ret = pkg_malloc(total_len);
 	if (!ret) {
 		LOG(L_ERR, "get_hfblock: no pkg mem for hf block\n");




More information about the sr-dev mailing list