bug 1190: Fix possible code injection
authorMichael Tänzer <neo@nhng.de>
Mon, 15 Jul 2013 15:59:16 +0000 (17:59 +0200)
committerMichael Tänzer <neo@nhng.de>
Mon, 15 Jul 2013 15:59:16 +0000 (17:59 +0200)
Signed-off-by: Michael Tänzer <neo@nhng.de>
pages/index/0.php

index a44b0a8..79a677d 100644 (file)
 
                $query = "./link";
                $nodeList = $xpath->query($query, $item);
-               $link = $nodeList->item(0)->nodeValue;
+               $link = htmlspecialchars($nodeList->item(0)->nodeValue);
 
                $query = "./description";
                $nodeList = $xpath->query($query, $item);
                $description = str_replace("&amp;#", "&#", recode_string("UTF8..html" , $nodeList->item(0)->nodeValue));
 
-               printf("<h3> %s </h3>\n", $title);
-               printf("<p> %s </p>\n", $description);
-               printf("<p>[<a href='%s'> %s </a> ] </p>\n\n", $link,_("Full Story"));
+               printf('<h3> %s </h3>\n', $title);
+               printf('<p> %s </p>\n', $description);
+               printf('<p>[<a href="%s"> %s </a> ] </p>\n\n', $link,_("Full Story"));
 
                $title = '';
                $description = '';