From: Seb Sauvage Date: Wed, 11 Jan 2012 21:17:28 +0000 (+0100) Subject: Version 0.0.33 beta: X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=45e88576b3e9658c9f4987d20e2241538b2b5185;p=github%2Fshaarli%2FShaarli.git Version 0.0.33 beta: - Corrected: XSS vulnerability patched (thanks to Stanislas D. !) - Corrected: ATOM feed validates again. --- 45e88576b3e9658c9f4987d20e2241538b2b5185 diff --cc index.php index e78733bf,e78733bf..011aeed9 --- a/index.php +++ b/index.php @@@ -1,5 -1,5 +1,5 @@@ ++function nl2br_escaped($html) ++{ ++ return str_replace('>','>',str_replace('<','<',nl2br($html))); ++} ++ /* Returns the small hash of a string eg. smallHash('20111006_131924') --> yZH23w Small hashes: @@@ -515,8 -515,8 +521,8 @@@ class pageBuilde $this->tpl->assign('linkcount',count($LINKSDB)); $this->tpl->assign('feedurl',htmlspecialchars(indexUrl())); $searchcrits=''; // Search criteria -- if (!empty($_GET['searchtags'])) $searchcrits.='&searchtags='.$_GET['searchtags']; -- elseif (!empty($_GET['searchterm'])) $searchcrits.='&searchterm='.$_GET['searchterm']; ++ if (!empty($_GET['searchtags'])) $searchcrits.='&searchtags='.urlencode($_GET['searchtags']); ++ elseif (!empty($_GET['searchterm'])) $searchcrits.='&searchterm='.urlencode($_GET['searchterm']); $this->tpl->assign('searchcrits',$searchcrits); $this->tpl->assign('source',indexUrl()); $this->tpl->assign('version',shaarli_version); @@@ -791,7 -791,7 +797,7 @@@ function showATOM( if (startsWith($absurl,'?')) $absurl=$pageaddr.$absurl; // make permalink URL absolute $entries.=''.htmlspecialchars($link['title']).''.$guid.''; if (!$GLOBALS['config']['HIDE_TIMESTAMPS'] || isLoggedIn()) $entries.=''.htmlspecialchars($iso8601date).''; -- $entries.=''.nl2br(keepMultipleSpaces(text2clickable(htmlspecialchars($link['description']))))."\n"; ++ $entries.=''.htmlspecialchars(nl2br(keepMultipleSpaces(text2clickable(htmlspecialchars($link['description'])))))."\n"; if ($link['tags']!='') // Adding tags to each ATOM entry (as mentioned in ATOM specification) { foreach(explode(' ',$link['tags']) as $tag) @@@ -803,14 -803,14 +809,14 @@@ $feed=''; $feed.=''.htmlspecialchars($GLOBALS['title']).''; if (!$GLOBALS['config']['HIDE_TIMESTAMPS'] || isLoggedIn()) $feed.=''.htmlspecialchars($latestDate).''; -- $feed.=''; ++ $feed.=''; if (!empty($GLOBALS['config']['PUBSUBHUB_URL'])) { $feed.=''; $feed.=''; $feed.=''; } -- $feed.=''.htmlspecialchars($pageaddr).''; ++ $feed.=''.htmlspecialchars($pageaddr).''.htmlspecialchars($pageaddr).''; $feed.=''.htmlspecialchars($pageaddr).''."\n\n"; // Yes, I know I should use a real IRI (RFC3987), but the site URL will do. $feed.=$entries; $feed.='';