stripsplashes doesn't work if the slash is the only character -> creating file in root dir leads to "//filename"

This commit is contained in:
Björn Schießle 2012-10-05 11:15:32 +02:00
parent a611ce4f33
commit f4136854b6

View file

@ -8,12 +8,11 @@ if(!OC_User::isLoggedIn()) {
}
session_write_close();
// Get the params
$dir = isset( $_REQUEST['dir'] ) ? stripslashes($_REQUEST['dir']) : '';
$filename = isset( $_REQUEST['filename'] ) ? stripslashes($_REQUEST['filename']) : '';
$dir = isset( $_REQUEST['dir'] ) ? trim($_REQUEST['dir'], '/\\') : '';
$filename = isset( $_REQUEST['filename'] ) ? trim($_REQUEST['filename'], '/\\') : '';
$content = isset( $_REQUEST['content'] ) ? $_REQUEST['content'] : '';
$source = isset( $_REQUEST['source'] ) ? stripslashes($_REQUEST['source']) : '';
$source = isset( $_REQUEST['source'] ) ? trim($_REQUEST['source'], '/\\') : '';
if($source) {
$eventSource=new OC_EventSource();