In a similar vein to [34133], escape the email address and IP address of comment authors to increase defence in depth.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35712 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
John Blackbourn 2015-11-29 02:43:24 +00:00
parent 6f37afb6ec
commit ec24d6e001
3 changed files with 5 additions and 5 deletions

View File

@ -695,7 +695,7 @@ class WP_Comments_List_Table extends WP_List_Table {
$email = apply_filters( 'comment_email', $comment->comment_author_email, $comment ); $email = apply_filters( 'comment_email', $comment->comment_author_email, $comment );
if ( ! empty( $email ) && '@' !== $email ) { if ( ! empty( $email ) && '@' !== $email ) {
printf( '<a href=\'mailto:%1$s\'>%1$s</a><br />', $email ); printf( '<a href="%1$s">%2$s</a><br />', esc_url( 'mailto:' . $email ), esc_html( $email ) );
} }
} }
@ -705,7 +705,7 @@ class WP_Comments_List_Table extends WP_List_Table {
if ( 'spam' === $comment_status ) { if ( 'spam' === $comment_status ) {
$author_ip_url = add_query_arg( 'comment_status', 'spam', $author_ip_url ); $author_ip_url = add_query_arg( 'comment_status', 'spam', $author_ip_url );
} }
printf( '<a href="%s">%s</a>', esc_url( $author_ip_url ), $author_ip ); printf( '<a href="%1$s">%2$s</a>', esc_url( $author_ip_url ), esc_html( $author_ip ) );
} }
} }
} }

View File

@ -184,7 +184,7 @@ function get_comment_author_email_link( $linktext = '', $before = '', $after = '
if ((!empty($email)) && ($email != '@')) { if ((!empty($email)) && ($email != '@')) {
$display = ($linktext != '') ? $linktext : $email; $display = ($linktext != '') ? $linktext : $email;
$return = $before; $return = $before;
$return .= "<a href='mailto:$email'>$display</a>"; $return .= sprintf( '<a href="%1$s">%2$s</a>', esc_url( 'mailto:' . $email ), esc_html( $display ) );
$return .= $after; $return .= $after;
return $return; return $return;
} else { } else {
@ -278,7 +278,7 @@ function get_comment_author_IP( $comment_ID = 0 ) {
* Default current comment. * Default current comment.
*/ */
function comment_author_IP( $comment_ID = 0 ) { function comment_author_IP( $comment_ID = 0 ) {
echo get_comment_author_IP( $comment_ID ); echo esc_html( get_comment_author_IP( $comment_ID ) );
} }
/** /**

View File

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