Skip to content

Commit

Permalink
I18N: Add hardening for invalid meta lines in MO files.
Browse files Browse the repository at this point in the history
Props swissspidy, pander.
Fixes #61794.

git-svn-id: https://develop.svn.wordpress.org/trunk@58922 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
swissspidy committed Aug 22, 2024
1 parent 84332c9 commit 06f7c82
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/wp-includes/l10n/class-wp-translation-file-mo.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ protected function parse_file(): bool {
// Metadata about the MO file is stored in the first translation entry.
if ( '' === $original ) {
foreach ( explode( "\n", $translation ) as $meta_line ) {
if ( '' === $meta_line ) {
if ( '' === $meta_line || ! str_contains( $meta_line, ':' ) ) {
continue;
}

Expand Down

0 comments on commit 06f7c82

Please sign in to comment.