1
0
Fork 0

MSD-4 Implement whitelist check for langId parameter passed to flag.php

Dieser Commit ist enthalten in:
JanRei 2011-07-03 16:27:27 +00:00
Ursprung 9246cc9533
Commit 3ec58d6bc3
1 geänderte Dateien mit 10 neuen und 13 gelöschten Zeilen

Datei anzeigen

@ -1,16 +1,13 @@
<?php
//TODO security -> implement whitelist of characters for langId
$country = str_replace(
array('..', "\x00"),
'',
$_GET['langId']
);
$country = $_GET['langId'];
$languageDir = realpath(dirname(__FILE__) . '/../application/language');
if (preg_match('/^[A-Z0-9_]+\z/i', $country)) {
define('DS', DIRECTORY_SEPARATOR);
$languageDir = realpath(dirname(__FILE__) . '/../application/language');
$image = $languageDir . DS . $country . DS . 'flag.gif';
header('Content-Type: image/gif');
define('DS', DIRECTORY_SEPARATOR);
$image = $languageDir . DS . $country . DS . 'flag.gif';
readfile(realpath($image));
if (file_exists($image)) {
header('Content-Type: image/gif');
readfile(realpath($image));
}
}