Index: wp-comments-post.php =================================================================== --- wp-comments-post.php (revision 23403) +++ wp-comments-post.php (working copy) @@ -17,8 +17,10 @@ nocache_headers(); -$comment_post_ID = isset($_POST['comment_post_ID']) ? (int) $_POST['comment_post_ID'] : 0; +$post_data = wp_unslash( $_POST ); +$comment_post_ID = isset($post_data['comment_post_ID']) ? (int) $post_data['comment_post_ID'] : 0; + $post = get_post($comment_post_ID); if ( empty($post->comment_status) ) { @@ -47,21 +49,21 @@ do_action('pre_comment_on_post', $comment_post_ID); } -$comment_author = ( isset($_POST['author']) ) ? trim(strip_tags($_POST['author'])) : null; -$comment_author_email = ( isset($_POST['email']) ) ? trim($_POST['email']) : null; -$comment_author_url = ( isset($_POST['url']) ) ? trim($_POST['url']) : null; -$comment_content = ( isset($_POST['comment']) ) ? trim($_POST['comment']) : null; +$comment_author = ( isset( $post_data['author'] ) ) ? trim( strip_tags( $post_data['author'] ) ) : null; +$comment_author_email = ( isset( $post_data['email'] ) ) ? trim( $post_data['email'] ) : null; +$comment_author_url = ( isset( $post_data['url'] ) ) ? trim( $post_data['url'] ) : null; +$comment_content = ( isset( $post_data['comment'] ) ) ? trim( $post_data['comment'] ) : null; // If the user is logged in $user = wp_get_current_user(); if ( $user->exists() ) { if ( empty( $user->display_name ) ) - $user->display_name=$user->user_login; - $comment_author = $wpdb->escape($user->display_name); - $comment_author_email = $wpdb->escape($user->user_email); - $comment_author_url = $wpdb->escape($user->user_url); + $user->display_name = $user->user_login; + $comment_author = $user->display_name; + $comment_author_email = $user->user_email; + $comment_author_url = $user->user_url; if ( current_user_can('unfiltered_html') ) { - if ( wp_create_nonce('unfiltered-html-comment_' . $comment_post_ID) != $_POST['_wp_unfiltered_html_comment'] ) { + if ( wp_create_nonce('unfiltered-html-comment_' . $comment_post_ID) != $post_data['_wp_unfiltered_html_comment'] ) { kses_remove_filters(); // start with a clean slate kses_init_filters(); // set up the filters } @@ -83,7 +85,7 @@ if ( '' == $comment_content ) wp_die( __('ERROR: please type a comment.') ); -$comment_parent = isset($_POST['comment_parent']) ? absint($_POST['comment_parent']) : 0; +$comment_parent = isset($post_data['comment_parent']) ? absint($post_data['comment_parent']) : 0; $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID'); @@ -92,7 +94,7 @@ $comment = get_comment($comment_id); do_action('set_comment_cookies', $comment, $user); -$location = empty($_POST['redirect_to']) ? get_comment_link($comment_id) : $_POST['redirect_to'] . '#comment-' . $comment_id; +$location = empty($post_data['redirect_to']) ? get_comment_link($comment_id) : $post_data['redirect_to'] . '#comment-' . $comment_id; $location = apply_filters('comment_post_redirect', $location, $comment); wp_safe_redirect( $location ); Index: wp-login.php =================================================================== --- wp-login.php (revision 23403) +++ wp-login.php (working copy) @@ -396,7 +396,7 @@ } // 10 days - setcookie( 'wp-postpass_' . COOKIEHASH, $wp_hasher->HashPassword( stripslashes( $_POST['post_password'] ) ), time() + 10 * DAY_IN_SECONDS, COOKIEPATH ); + setcookie( 'wp-postpass_' . COOKIEHASH, $wp_hasher->HashPassword( wp_unslash( $_POST['post_password'] ) ), time() + 10 * DAY_IN_SECONDS, COOKIEPATH ); wp_safe_redirect( wp_get_referer() ); exit(); @@ -431,7 +431,7 @@ do_action('lost_password'); login_header(__('Lost Password'), '
', $errors); - $user_login = isset($_POST['user_login']) ? stripslashes($_POST['user_login']) : ''; + $user_login = isset($_POST['user_login']) ? wp_unslash($_POST['user_login']) : ''; ?> @@ -530,8 +530,8 @@ $user_login = ''; $user_email = ''; if ( $http_post ) { - $user_login = $_POST['user_login']; - $user_email = $_POST['user_email']; + $user_login = wp_unslash( $_POST['user_login'] ); + $user_email = wp_unslash( $_POST['user_email'] ); $errors = register_new_user($user_login, $user_email); if ( !is_wp_error($errors) ) { $redirect_to = !empty( $_POST['redirect_to'] ) ? $_POST['redirect_to'] : 'wp-login.php?checkemail=registered'; @@ -547,11 +547,11 @@