Make WordPress Core

Changeset 42314 for branches/3.7


Ignore:
Timestamp:
11/29/2017 04:51:21 PM (8 years ago)
Author:
johnbillion
Message:

Hardening: Ensure the attributes of enclosures are correctly escaped in RSS and Atom feeds.

Merges [42260] to the 3.7 branch.

Location:
branches/3.7
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/3.7

  • branches/3.7/src

  • branches/3.7/src/wp-includes/feed.php

    r25616 r42314  
    396396                $type = $t[0];
    397397
    398                 echo apply_filters('rss_enclosure', '<enclosure url="' . trim(htmlspecialchars($enclosure[0])) . '" length="' . trim($enclosure[1]) . '" type="' . $type . '" />' . "\n");
     398                echo apply_filters( 'rss_enclosure', '<enclosure url="' . esc_url( trim( $enclosure[0] ) ) . '" length="' . absint( trim( $enclosure[1] ) ) . '" type="' . esc_attr( $type ) . '" />' . "\n" );
    399399            }
    400400        }
     
    427427            foreach ( (array) $val as $enc ) {
    428428                $enclosure = explode("\n", $enc);
    429                 echo apply_filters('atom_enclosure', '<link href="' . trim(htmlspecialchars($enclosure[0])) . '" rel="enclosure" length="' . trim($enclosure[1]) . '" type="' . trim($enclosure[2]) . '" />' . "\n");
     429                echo apply_filters( 'atom_enclosure', '<link href="' . esc_url( trim( $enclosure[0] ) ) . '" rel="enclosure" length="' . absint( trim( $enclosure[1] ) ) . '" type="' . esc_attr( trim( $enclosure[2] ) ) . '" />' . "\n" );
    430430            }
    431431        }
Note: See TracChangeset for help on using the changeset viewer.