Skip to content

Commit 5894507

Browse files
committed
Disable external entities in ID3.
git-svn-id: https://develop.svn.wordpress.org/trunk@29378 602fd350-edb4-49c9-b593-d223f7449a82
1 parent a8e8ed6 commit 5894507

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/wp-includes/ID3/getid3.lib.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -519,11 +519,12 @@ public static function array_min($arraydata, $returnkey=false) {
519519
}
520520

521521
public static function XML2array($XMLstring) {
522-
if (function_exists('simplexml_load_string')) {
523-
if (function_exists('get_object_vars')) {
524-
$XMLobject = simplexml_load_string($XMLstring);
525-
return self::SimpleXMLelement2array($XMLobject);
526-
}
522+
if ( function_exists( 'simplexml_load_string' ) && function_exists( 'libxml_disable_entity_loader' ) ) {
523+
$loader = libxml_disable_entity_loader( true );
524+
$XMLobject = simplexml_load_string( $XMLstring, 'SimpleXMLElement', LIBXML_NOENT );
525+
$return = self::SimpleXMLelement2array( $XMLobject );
526+
libxml_disable_entity_loader( $loader );
527+
return $return;
527528
}
528529
return false;
529530
}

0 commit comments

Comments
 (0)