WordPress.org

Make WordPress Core

Changeset 12168


Ignore:
Timestamp:
11/11/09 23:54:43 (5 years ago)
Author:
markjaquith
Message:

Prevent XSS in press-this.php. props Benjamin Flesch. fixes #11119

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/press-this.php

    r12112 r12168  
    9292 
    9393// Set Variables 
    94 $title = isset($_GET['t']) ? esc_html(aposfix(stripslashes($_GET['t']))) : ''; 
    95 $selection = isset($_GET['s']) ? trim( aposfix( stripslashes($_GET['s']) ) ) : ''; 
     94$title = isset( $_GET['t'] ) ? trim( strip_tags( aposfix( stripslashes( $_GET['t'] ) ) ) ) : ''; 
     95$selection = isset( $_GET['s'] ) ? trim( htmlspecialchars( html_entity_decode( aposfix( stripslashes( $_GET['s'] ) ) ) ) ) : ''; 
    9696if ( ! empty($selection) ) { 
    9797    $selection = preg_replace('/(\r?\n|\r)/', '</p><p>', $selection); 
    9898    $selection = '<p>'.str_replace('<p></p>', '', $selection).'</p>'; 
    9999} 
     100 
    100101$url = isset($_GET['u']) ? esc_url($_GET['u']) : ''; 
    101102$image = isset($_GET['i']) ? $_GET['i'] : ''; 
     
    120121                <h2><label for="embed-code"><?php _e('Embed Code') ?></label></h2> 
    121122                <div class="inside"> 
    122                     <textarea name="embed-code" id="embed-code" rows="8" cols="40"><?php echo format_to_edit($selection, true); ?></textarea> 
     123                    <textarea name="embed-code" id="embed-code" rows="8" cols="40"><?php echo wp_htmledit_pre( $selection ); ?></textarea> 
    123124                    <p id="options"><a href="#" class="select button"><?php _e('Insert Video'); ?></a> <a href="#" class="close button"><?php _e('Cancel'); ?></a></p> 
    124125                </div> 
     
    577578                <textarea name="content" id="content" style="width:100%;" class="theEditor" rows="15"><?php 
    578579                    if ( $selection ) 
    579                         echo wp_richedit_pre(htmlspecialchars_decode($selection)); 
     580                        echo wp_richedit_pre($selection); 
    580581                    if ( $url ) { 
    581582                        echo '<p>'; 
Note: See TracChangeset for help on using the changeset viewer.