Make WordPress Core


Ignore:
Timestamp:
09/14/2015 10:47:19 PM (11 years ago)
Author:
nbachiyski
Message:

Shortcodes: don't allow unclosed HTML elements in attributes

Merges [34134] for 4.2 branch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/4.2/src/wp-includes/shortcodes.php

    r33518 r34145  
    458458                                $atts[] = stripcslashes($m[8]);
    459459                }
     460
     461                // Reject any unclosed HTML elements
     462                foreach( $atts as &$value ) {
     463                        if ( false !== strpos( $value, '<' ) ) {
     464                                if ( 1 !== preg_match( '/^[^<]*+(?:<[^>]*+>[^<]*+)*+$/', $value ) ) {
     465                                        $value = '';
     466                                }
     467                        }
     468                }
    460469        } else {
    461470                $atts = ltrim($text);
Note: See TracChangeset for help on using the changeset viewer.