aboutsummaryrefslogtreecommitdiffstats
path: root/include/bbcode.php
diff options
context:
space:
mode:
authorHaakon Meland Eriksen <haakon.eriksen@far.no>2015-11-06 15:58:56 +0100
committerHaakon Meland Eriksen <haakon.eriksen@far.no>2015-11-06 15:58:56 +0100
commit5776af30e84356dade6b644a56dce2094ecb99eb (patch)
tree985a3325bdf75e341d70b2305c923dfbb2064972 /include/bbcode.php
parent91f751d10531e73078f7efb4efa1f5e215a8f871 (diff)
parent4ca0c2cfd14df5e2b6e9c7f59a10628f7653d6a4 (diff)
downloadvolse-hubzilla-5776af30e84356dade6b644a56dce2094ecb99eb.tar.gz
volse-hubzilla-5776af30e84356dade6b644a56dce2094ecb99eb.tar.bz2
volse-hubzilla-5776af30e84356dade6b644a56dce2094ecb99eb.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'include/bbcode.php')
-rw-r--r--include/bbcode.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/include/bbcode.php b/include/bbcode.php
index 517f22bee..05802aa57 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -599,6 +599,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false)
$Text = preg_replace("/\[mail\=([$MAILSearchString]*)\](.*?)\[\/mail\]/", '<a href="mailto:$1" target="_newwin" >$2</a>', $Text);
}
+
// leave open the posibility of [map=something]
// this is replaced in prepare_body() which has knowledge of the item location
@@ -983,7 +984,12 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false)
$Text = preg_replace('/\[\&amp\;([#a-z0-9]+)\;\]/', '&$1;', $Text);
// fix any escaped ampersands that may have been converted into links
- $Text = preg_replace("/\<(.*?)(src|href)=(.*?)\&amp\;(.*?)\>/ism", '<$1$2=$3&$4>', $Text);
+
+ if(strpos($Text,'&amp;') !== false)
+ $Text = preg_replace("/\<(.*?)(src|href)=(.*?)\&amp\;(.*?)\>/ism", '<$1$2=$3&$4>', $Text);
+
+ // This is subtle - it's an XSS filter. It only accepts links with a protocol scheme and where
+ // the scheme begins with z (zhttp), h (http(s)), f (ftp), m (mailto), and named anchors.
$Text = preg_replace("/\<(.*?)(src|href)=\"[^zhfm#](.*?)\>/ism", '<$1$2="">', $Text);