From f52de4e4536aff5fafbb6cffcc055fe57846282d Mon Sep 17 00:00:00 2001 From: ztree Date: Fri, 4 Dec 2015 17:21:05 +0800 Subject: [PATCH] fix CVE-2015-7348 --- demo/cn/asyncData/getNodes.php | 6 ++---- demo/cn/asyncData/getNodesForBigData.php | 5 ++--- demo/en/asyncData/getNodes.php | 6 ++---- demo/en/asyncData/getNodesForBigData.php | 5 ++--- 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/demo/cn/asyncData/getNodes.php b/demo/cn/asyncData/getNodes.php index 55c3918af..6d22b5ebd 100644 --- a/demo/cn/asyncData/getNodes.php +++ b/demo/cn/asyncData/getNodes.php @@ -21,11 +21,9 @@ if ($pLevel==null || $pLevel=="") $pLevel = "0"; if ($pName==null) $pName = ""; else $pName = $pName."."; -$pId = str_replace("%<%", "<", $pId); -$pId = str_replace("%>%", ">", $pId); +$pId = htmlspecialchars($pId); -$pName = str_replace("%<%", "<", $pName); -$pName = str_replace("%>%", ">", $pName); +$pName = htmlspecialchars($pName); //for ($i=1; $i<9999; $i++) { // for ($j=1; $j<999; $j++) { diff --git a/demo/cn/asyncData/getNodesForBigData.php b/demo/cn/asyncData/getNodesForBigData.php index f91098f4b..588c14c5c 100644 --- a/demo/cn/asyncData/getNodesForBigData.php +++ b/demo/cn/asyncData/getNodesForBigData.php @@ -11,8 +11,7 @@ if(array_key_exists( 'count',$_REQUEST)) { if ($pId==null || $pId=="") $pId = "0"; if ($pCount==null || $pCount=="") $pCount = "10"; -$pId = str_replace("%<%", "<", $pId); -$pId = str_replace("%>%", ">", $pId); +$pId = htmlspecialchars($pId); $max = (int)$pCount; for ($i=1; $i<=$max; $i++) { @@ -24,4 +23,4 @@ for ($i=1; $i<=$max; $i++) { } } -?>] \ No newline at end of file +?>] diff --git a/demo/en/asyncData/getNodes.php b/demo/en/asyncData/getNodes.php index 55c3918af..6d22b5ebd 100644 --- a/demo/en/asyncData/getNodes.php +++ b/demo/en/asyncData/getNodes.php @@ -21,11 +21,9 @@ if ($pLevel==null || $pLevel=="") $pLevel = "0"; if ($pName==null) $pName = ""; else $pName = $pName."."; -$pId = str_replace("%<%", "<", $pId); -$pId = str_replace("%>%", ">", $pId); +$pId = htmlspecialchars($pId); -$pName = str_replace("%<%", "<", $pName); -$pName = str_replace("%>%", ">", $pName); +$pName = htmlspecialchars($pName); //for ($i=1; $i<9999; $i++) { // for ($j=1; $j<999; $j++) { diff --git a/demo/en/asyncData/getNodesForBigData.php b/demo/en/asyncData/getNodesForBigData.php index f91098f4b..588c14c5c 100644 --- a/demo/en/asyncData/getNodesForBigData.php +++ b/demo/en/asyncData/getNodesForBigData.php @@ -11,8 +11,7 @@ if(array_key_exists( 'count',$_REQUEST)) { if ($pId==null || $pId=="") $pId = "0"; if ($pCount==null || $pCount=="") $pCount = "10"; -$pId = str_replace("%<%", "<", $pId); -$pId = str_replace("%>%", ">", $pId); +$pId = htmlspecialchars($pId); $max = (int)$pCount; for ($i=1; $i<=$max; $i++) { @@ -24,4 +23,4 @@ for ($i=1; $i<=$max; $i++) { } } -?>] \ No newline at end of file +?>] -- GitLab