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

git-svn-id: https://develop.svn.wordpress.org/trunk@35748 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
John Blackbourn 2015-11-29 02:40:42 +00:00
parent da2acf666a
commit 6565b3e423
2 changed files with 4 additions and 4 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 ) );
} }
/** /**