Correctly fail if file is too short (bug #1574340).
This commit is contained in:
@@ -7,6 +7,8 @@ $Source$
|
||||
|
||||
2006-10-10 Michal Čihař <michal@cihar.com>
|
||||
* lang/german: Fix typo (translation #1467138).
|
||||
* libraries/import.lib.php: Correctly fail if file is too short (bug
|
||||
#1574340).
|
||||
|
||||
2006-10-09 Michal Čihař <michal@cihar.com>
|
||||
* lang/german: Fix typo (translation #1570611).
|
||||
|
@@ -45,14 +45,15 @@ function PMA_detectCompression($filepath)
|
||||
return FALSE;
|
||||
}
|
||||
$test = fread($file, 4);
|
||||
$len = strlen($test);
|
||||
fclose($file);
|
||||
if ($test[0] == chr(31) && $test[1] == chr(139)) {
|
||||
if ($len >= 2 && $test[0] == chr(31) && $test[1] == chr(139)) {
|
||||
return 'application/gzip';
|
||||
}
|
||||
if (substr($test, 0, 3) == 'BZh') {
|
||||
if ($len >= 3 && substr($test, 0, 3) == 'BZh') {
|
||||
return 'application/bzip2';
|
||||
}
|
||||
if ($test == "PK\003\004") {
|
||||
if ($len >= 4 && $test == "PK\003\004") {
|
||||
return 'application/zip';
|
||||
}
|
||||
return 'none';
|
||||
|
Reference in New Issue
Block a user