浏览代码

tm: safety check not to allocate 0 bytes in rpc command

Daniel-Constantin Mierla 10 年之前
父节点
当前提交
88b67575f9
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      modules/tm/rpc_uac.c

+ 6 - 1
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");