Module: kamailio
Branch: 4.2
Commit: 3fd7f816607acbc80ed49b5743dd55870d6b1e92
URL:
https://github.com/kamailio/kamailio/commit/3fd7f816607acbc80ed49b5743dd558…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2015-05-19T09:30:31+02:00
tm: safety check not to allocate 0 bytes in rpc command
(cherry picked from commit 88b67575f9457312d0277e16dc06103be3a31965)
---
Modified: modules/tm/rpc_uac.c
---
Diff:
https://github.com/kamailio/kamailio/commit/3fd7f816607acbc80ed49b5743dd558…
Patch:
https://github.com/kamailio/kamailio/commit/3fd7f816607acbc80ed49b5743dd558…
---
diff --git a/modules/tm/rpc_uac.c b/modules/tm/rpc_uac.c
index 507f4ae..db692ef 100644
--- a/modules/tm/rpc_uac.c
+++ b/modules/tm/rpc_uac.c
@@ -218,7 +218,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");