Make WordPress Core

Changeset 42274 for branches/4.7


Ignore:
Timestamp:
11/29/2017 04:18:56 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 4.7 branch.

Location:
branches/4.7
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.7

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

    r39683 r42274  
    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.