From 0db313f0047fc512dec2976cac168989b60d49c8 Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Thu, 14 May 2015 13:24:38 +0200 Subject: [PATCH] tmx: check for empty result not to allocate 0 bytes - allocation of 0 size is undefined when using system malloc --- modules/tmx/t_mi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/tmx/t_mi.c b/modules/tmx/t_mi.c index 735e9114920..485b160eec1 100644 --- a/modules/tmx/t_mi.c +++ b/modules/tmx/t_mi.c @@ -228,6 +228,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);