Module: kamailio
Branch: 4.2
Commit: 7cb9428ec3785e42b95eb2cc30cb4ac8503e760d
URL:
https://github.com/kamailio/kamailio/commit/7cb9428ec3785e42b95eb2cc30cb4ac…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2015-05-19T09:29:59+02:00
tmx: check for empty result not to allocate 0 bytes
- allocation of 0 size is undefined when using system malloc
(cherry picked from commit 0db313f0047fc512dec2976cac168989b60d49c8)
---
Modified: modules/tmx/t_mi.c
---
Diff:
https://github.com/kamailio/kamailio/commit/7cb9428ec3785e42b95eb2cc30cb4ac…
Patch:
https://github.com/kamailio/kamailio/commit/7cb9428ec3785e42b95eb2cc30cb4ac…
---
diff --git a/modules/tmx/t_mi.c b/modules/tmx/t_mi.c
index 97123f7..e3bff25 100644
--- a/modules/tmx/t_mi.c
+++ b/modules/tmx/t_mi.c
@@ -233,6 +233,10 @@ static inline char *get_hfblock( str *uri, struct hdr_field *hf, int
*l, struct
LM_DBG("one more hf processed\n");
} /* header loop */
+ if(total_len==0) {
+ LM_DBG("empty result\n");
+ goto error;
+ }
/* construct a single header block now */
ret=pkg_malloc(total_len);