Fixed a bug in the input checking of files when Diskfile source was configured

This commit is contained in:
Andre Lorbach 2008-07-25 14:25:32 +02:00
parent 0ad4650993
commit e6dc1e4b25
2 changed files with 31 additions and 3 deletions

View File

@ -334,10 +334,29 @@ if ( isset($_POST['op']) )
$content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_SOURCES_ERROR_MISSINGPARAM'], $content['LN_CFG_SYSLOGFILE'] );
}
// Check if file is accessable!
else if ( !is_file($content['SourceDiskFile']) )
else
{
$content['ISERROR'] = true;
$content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_SOURCES_ERROR_NOTAVALIDFILE'], $content['SourceDiskFile'] );
// Get plain filename for testing!
$szFileName = DB_StripSlahes($content['SourceDiskFile']);
// Take as it is if rootpath!
if (
( ($pos = strpos($szFileName, "/")) !== FALSE && $pos == 0) ||
( ($pos = strpos($szFileName, ":\\")) !== FALSE ) ||
( ($pos = strpos($szFileName, ":/")) !== FALSE )
)
{
// Nothing really todo
$szFileName = $szFileName;
}
else // prepend basepath!
$szFileName = $gl_root_path . $szFileName;
if ( !is_file($szFileName) )
{
$content['ISERROR'] = true;
$content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_SOURCES_ERROR_NOTAVALIDFILE'], $szFileName );
}
}
}
// DB Params

View File

@ -248,6 +248,15 @@ function DB_RemoveBadChars($myString)
*/
}
function DB_StripSlahes($myString)
{
// Replace with internal PHP Functions!
if ( !get_magic_quotes_runtime() )
return stripslashes($myString);
else
return $myString;
}
function DB_ReturnLastInsertID($myResult = false)
{
// --- Abort in this case!