Shortcodes: don't allow unclosed HTML elements in attributes

Built from https://develop.svn.wordpress.org/trunk@34134


git-svn-id: http://core.svn.wordpress.org/trunk@34102 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Nikolay Bachiyski 2015-09-14 22:36:24 +00:00
parent 097c4fd2f4
commit 3778cae8ec
3 changed files with 12 additions and 1 deletions

View File

@ -870,6 +870,8 @@ function img_caption_shortcode( $attr, $content = null ) {
$content = $matches[1];
$attr['caption'] = trim( $matches[2] );
}
} elseif ( strpos( $attr['caption'], '<' ) !== false ) {
$attr['caption'] = wp_kses( $attr['caption'], 'post' );
}
/**

View File

@ -462,6 +462,15 @@ function shortcode_parse_atts($text) {
elseif (isset($m[8]))
$atts[] = stripcslashes($m[8]);
}
// Reject any unclosed HTML elements
foreach( $atts as &$value ) {
if ( false !== strpos( $value, '<' ) ) {
if ( 1 !== preg_match( '/^[^<]*+(?:<[^>]*+>[^<]*+)*+$/', $value ) ) {
$value = '';
}
}
}
} else {
$atts = ltrim($text);
}

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.4-alpha-34133';
$wp_version = '4.4-alpha-34134';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.