Make WordPress Core

Changeset 11808


Ignore:
Timestamp:
08/13/2009 06:03:26 AM (17 years ago)
Author:
azaozz
Message:

Strip slashes from POST data in request_filesystem_credentials(), props dd32, fixes #10567

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/file.php

    r11712 r11808  
    677677
    678678        // If defined, set it to that, Else, If POST'd, set it to that, If not, Set it to whatever it previously was(saved details in option)
    679         $credentials['hostname'] = defined('FTP_HOST') ? FTP_HOST : (!empty($_POST['hostname']) ? $_POST['hostname'] : $credentials['hostname']);
    680         $credentials['username'] = defined('FTP_USER') ? FTP_USER : (!empty($_POST['username']) ? $_POST['username'] : $credentials['username']);
    681         $credentials['password'] = defined('FTP_PASS') ? FTP_PASS : (!empty($_POST['password']) ? $_POST['password'] : '');
     679        $credentials['hostname'] = defined('FTP_HOST') ? FTP_HOST : (!empty($_POST['hostname']) ? stripslashes($_POST['hostname']) : $credentials['hostname']);
     680        $credentials['username'] = defined('FTP_USER') ? FTP_USER : (!empty($_POST['username']) ? stripslashes($_POST['username']) : $credentials['username']);
     681        $credentials['password'] = defined('FTP_PASS') ? FTP_PASS : (!empty($_POST['password']) ? stripslashes($_POST['password']) : '');
    682682
    683683        // Check to see if we are setting the public/private keys for ssh
    684         $credentials['public_key'] = defined('FTP_PUBKEY') ? FTP_PUBKEY : (!empty($_POST['public_key']) ? $_POST['public_key'] : '');
    685         $credentials['private_key'] = defined('FTP_PRIKEY') ? FTP_PRIKEY : (!empty($_POST['private_key']) ? $_POST['private_key'] : '');
     684        $credentials['public_key'] = defined('FTP_PUBKEY') ? FTP_PUBKEY : (!empty($_POST['public_key']) ? stripslashes($_POST['public_key']) : '');
     685        $credentials['private_key'] = defined('FTP_PRIKEY') ? FTP_PRIKEY : (!empty($_POST['private_key']) ? stripslashes($_POST['private_key']) : '');
    686686
    687687        //sanitize the hostname, Some people might pass in odd-data:
    … …  
    698698                $credentials['connection_type'] = 'ftps';
    699699        else if ( !empty($_POST['connection_type']) )
    700                 $credentials['connection_type'] = $_POST['connection_type'];
     700                $credentials['connection_type'] = stripslashes($_POST['connection_type']);
    701701        else if ( !isset($credentials['connection_type']) ) //All else fails (And its not defaulted to something else saved), Default to FTP
    702702                $credentials['connection_type'] = 'ftp';
    … …  
    792792
    793793<?php if ( isset( $_POST['version'] ) ) : ?>
    794 <input type="hidden" name="version" value="<?php echo esc_attr($_POST['version']) ?>" />
     794<input type="hidden" name="version" value="<?php echo esc_attr(stripslashes($_POST['version'])) ?>" />
    795795<?php endif; ?>
    796796<?php if ( isset( $_POST['locale'] ) ) : ?>
    797 <input type="hidden" name="locale" value="<?php echo esc_attr($_POST['locale']) ?>" />
     797<input type="hidden" name="locale" value="<?php echo esc_attr(stripslashes($_POST['locale'])) ?>" />
    798798<?php endif; ?>
    799799<p class="submit">
Note: See TracChangeset for help on using the changeset viewer.