Browse Source

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

Daniel-Constantin Mierla 10 years ago
parent
commit
88b67575f9
1 changed files with 6 additions and 1 deletions
  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");