Making WordPress.org

Changeset 13275


Ignore:
Timestamp:
03/05/2024 04:54:40 AM (17 months ago)
Author:
dd32
Message:

Plugin Directory: Readme Validator: Discard invalid inputs to avoid processing invalid readme's.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-readme-validator.php

    r11381 r13275  
    2121            $readme_contents = '';
    2222            if ( ! empty( $_REQUEST['readme'] ) && is_string( $_REQUEST['readme'] ) ) {
    23                 $readme_url = $_REQUEST['readme'];
     23                $readme_url = wp_unslash( $_REQUEST['readme'] );
    2424            }
    2525            if ( ! empty( $_POST['readme_contents'] ) && is_string( $_POST['readme_contents'] ) ) {
    26                 $readme_contents = base64_decode( wp_unslash( $_POST['readme_contents'] ) );
     26                $readme_contents = base64_decode( wp_unslash( $_POST['readme_contents'] ), true );
    2727            }
    2828            ?>
     
    6868
    6969        } elseif ( ! empty( $_POST['readme_contents'] ) && is_string( $_POST['readme_contents'] ) ) {
    70             $errors = Validator::instance()->validate_content( base64_decode( wp_unslash( $_REQUEST['readme_contents'] ) ) );
     70            $contents = base64_decode( wp_unslash( $_REQUEST['readme_contents'] ), true );
     71            if ( ! $contents ) {
     72                return;
     73            }
     74
     75            $errors = Validator::instance()->validate_content( $contents );
    7176
    7277        } else {
Note: See TracChangeset for help on using the changeset viewer.