Make WordPress Core

Changeset 42260


Ignore:
Timestamp:
11/29/2017 03:55:03 PM (8 years ago)
Author:
johnbillion
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/feed.php

    r42201 r42260  
    477477                 * @param string $html_link_tag The HTML link tag with a URI and other attributes.
    478478                 */
    479                 echo apply_filters( 'rss_enclosure', '<enclosure url="' . trim( htmlspecialchars( $enclosure[0] ) ) . '" length="' . trim( $enclosure[1] ) . '" type="' . $type . '" />' . "\n" );
     479                echo apply_filters( 'rss_enclosure', '<enclosure url="' . esc_url( trim( $enclosure[0] ) ) . '" length="' . absint( trim( $enclosure[1] ) ) . '" type="' . esc_attr( $type ) . '" />' . "\n" );
    480480            }
    481481        }
     
    511511                 * @param string $html_link_tag The HTML link tag with a URI and other attributes.
    512512                 */
    513                 echo apply_filters( 'atom_enclosure', '<link href="' . trim( htmlspecialchars( $enclosure[0] ) ) . '" rel="enclosure" length="' . trim( $enclosure[1] ) . '" type="' . trim( $enclosure[2] ) . '" />' . "\n" );
     513                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" );
    514514            }
    515515        }
Note: See TracChangeset for help on using the changeset viewer.