From ec24d6e001e7e386f25acf966258dee6494c04a1 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Sun, 29 Nov 2015 02:43:24 +0000 Subject: [PATCH] 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 --- wp-admin/includes/class-wp-comments-list-table.php | 4 ++-- wp-includes/comment-template.php | 4 ++-- wp-includes/version.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/wp-admin/includes/class-wp-comments-list-table.php b/wp-admin/includes/class-wp-comments-list-table.php index 8a70a1f5de..a7c6d869cf 100644 --- a/wp-admin/includes/class-wp-comments-list-table.php +++ b/wp-admin/includes/class-wp-comments-list-table.php @@ -695,7 +695,7 @@ class WP_Comments_List_Table extends WP_List_Table { $email = apply_filters( 'comment_email', $comment->comment_author_email, $comment ); if ( ! empty( $email ) && '@' !== $email ) { - printf( '%1$s
', $email ); + printf( '%2$s
', esc_url( 'mailto:' . $email ), esc_html( $email ) ); } } @@ -705,7 +705,7 @@ class WP_Comments_List_Table extends WP_List_Table { if ( 'spam' === $comment_status ) { $author_ip_url = add_query_arg( 'comment_status', 'spam', $author_ip_url ); } - printf( '%s', esc_url( $author_ip_url ), $author_ip ); + printf( '%2$s', esc_url( $author_ip_url ), esc_html( $author_ip ) ); } } } diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php index 6491b7b32a..ada53c8997 100644 --- a/wp-includes/comment-template.php +++ b/wp-includes/comment-template.php @@ -184,7 +184,7 @@ function get_comment_author_email_link( $linktext = '', $before = '', $after = ' if ((!empty($email)) && ($email != '@')) { $display = ($linktext != '') ? $linktext : $email; $return = $before; - $return .= "$display"; + $return .= sprintf( '%2$s', esc_url( 'mailto:' . $email ), esc_html( $display ) ); $return .= $after; return $return; } else { @@ -278,7 +278,7 @@ function get_comment_author_IP( $comment_ID = 0 ) { * Default current comment. */ function comment_author_IP( $comment_ID = 0 ) { - echo get_comment_author_IP( $comment_ID ); + echo esc_html( get_comment_author_IP( $comment_ID ) ); } /** diff --git a/wp-includes/version.php b/wp-includes/version.php index 7dc041afc4..34e03d227b 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @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.