[sr-dev] git:4.2:7cb9428e: tmx: check for empty result not to allocate 0 bytes
Daniel-Constantin Mierla
miconda at gmail.com
Tue May 19 09:32:27 CEST 2015
Module: kamailio
Branch: 4.2
Commit: 7cb9428ec3785e42b95eb2cc30cb4ac8503e760d
URL: https://github.com/kamailio/kamailio/commit/7cb9428ec3785e42b95eb2cc30cb4ac8503e760d
Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at 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/7cb9428ec3785e42b95eb2cc30cb4ac8503e760d.diff
Patch: https://github.com/kamailio/kamailio/commit/7cb9428ec3785e42b95eb2cc30cb4ac8503e760d.patch
---
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);
More information about the sr-dev
mailing list