瀏覽代碼

rtpengine: fix segfault when bad mi params

Default root pointer to NULL in order to avoid segfaults due to bad mi params
(e.g string instead of int). The segfaults happened because in the above cases,
free_mi_tree(root) tries to free a random, invalid address.
Stefan Mititelu 10 年之前
父節點
當前提交
6e2f4d7d24
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      modules/rtpengine/rtpengine.c

+ 3 - 3
modules/rtpengine/rtpengine.c

@@ -854,7 +854,7 @@ static struct mi_root* mi_enable_rtp_proxy(struct mi_root *cmd_tree,
 	struct mi_node *node, *crt_node;
 	struct rtpp_set *rtpp_list;
 	struct rtpp_node *crt_rtpp, *found_rtpp;
-	struct mi_root *root;
+	struct mi_root *root = NULL;
 	struct mi_attr *attr;
 	unsigned int enable;
 	int found, found_rtpp_disabled;
@@ -1099,7 +1099,7 @@ static struct mi_root* mi_show_rtp_proxy(struct mi_root* cmd_tree,
 												void* param)
 {
 	struct mi_node *node;
-	struct mi_root *root;
+	struct mi_root *root = NULL;
 	struct rtpp_set *rtpp_list;
 	struct rtpp_node *crt_rtpp;
 	int found;
@@ -1190,7 +1190,7 @@ static struct mi_root* mi_ping_rtp_proxy(struct mi_root* cmd_tree,
 {
 	struct mi_node *node, *crt_node;
 	struct mi_attr *attr;
-	struct mi_root *root;
+	struct mi_root *root = NULL;
 	struct rtpp_set *rtpp_list;
 	struct rtpp_node *crt_rtpp, *found_rtpp;
 	int found, found_rtpp_disabled;