Skip to content

Commit 3713ac5

Browse files
committed
Hardening: Add escaping to the language attributes used on html elements.
Built from https://develop.svn.wordpress.org/trunk@42259 git-svn-id: http://core.svn.wordpress.org/trunk@42088 1a063a9b-81f0-0310-95a4-ce76da25c4cd
1 parent eaf1cfd commit 3713ac5

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

Diff for: wp-includes/general-template.php

+7-5
Original file line numberDiff line numberDiff line change
@@ -3568,12 +3568,14 @@ function get_language_attributes( $doctype = 'html' ) {
35683568
if ( function_exists( 'is_rtl' ) && is_rtl() )
35693569
$attributes[] = 'dir="rtl"';
35703570

3571-
if ( $lang = get_bloginfo('language') ) {
3572-
if ( get_option('html_type') == 'text/html' || $doctype == 'html' )
3573-
$attributes[] = "lang=\"$lang\"";
3571+
if ( $lang = get_bloginfo( 'language' ) ) {
3572+
if ( get_option( 'html_type' ) == 'text/html' || $doctype == 'html' ) {
3573+
$attributes[] = 'lang="' . esc_attr( $lang ) . '"';
3574+
}
35743575

3575-
if ( get_option('html_type') != 'text/html' || $doctype == 'xhtml' )
3576-
$attributes[] = "xml:lang=\"$lang\"";
3576+
if ( get_option( 'html_type' ) != 'text/html' || $doctype == 'xhtml' ) {
3577+
$attributes[] = 'xml:lang="' . esc_attr( $lang ) . '"';
3578+
}
35773579
}
35783580

35793581
$output = implode(' ', $attributes);

Diff for: wp-includes/version.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* @global string $wp_version
66
*/
7-
$wp_version = '5.0-alpha-42258';
7+
$wp_version = '5.0-alpha-42259';
88

99
/**
1010
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

0 commit comments

Comments
 (0)