From 88b67575f9457312d0277e16dc06103be3a31965 Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Thu, 14 May 2015 13:40:11 +0200 Subject: [PATCH] tm: safety check not to allocate 0 bytes in rpc command --- modules/tm/rpc_uac.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/tm/rpc_uac.c b/modules/tm/rpc_uac.c index 14c02f01619..d223fd2945c 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");