);
@@ -1686,13 +1695,14 @@ FW_style($$)
my $ncols = $FW_ss ? 40 : 80;
FW_pO "";
FW_pO "";
@@ -1700,18 +1710,24 @@ FW_style($$)
} elsif($a[1] eq "save") {
my $fName = $a[2];
+ # I removed all that special treatment since $fName now contains the full original filename
+ # this means that one can in principle overwrite any file in the file system if fhem
+ # runs with too many rights, e.g. if run as root!
+
$fName = $FW_webArgs{saveName}
if($FW_webArgs{saveAs} && $FW_webArgs{saveName});
- $fName =~ s,/,,g; # little bit of security
+
+ #$fName =~ s,/,,g; # little bit of security
#$fName = ($fName eq "fhem.cfg" ? $attr{global}{configfile} :
# "$FW_dir/$fName");
- if($fName eq "fhem.cfg") {
- $fName = $attr{global}{configfile};
- } elsif ($fName =~ m/.*(sh|Util.*|cfg|holiday)/ && $fName ne "fhem.cfg") {
- $fName = "$MW_dir/$fName";
- } else {
- $fName = "$FW_dir/$fName";
- }
+ #if($fName eq "fhem.cfg") {
+ # $fName = $attr{global}{configfile};
+ #} elsif ($fName =~ m/.*(sh|Util.*|cfg|holiday)/ && $fName ne "fhem.cfg") {
+ # $fName = "$MW_dir/$fName";
+ #} else {
+ # $fName = "$FW_dir/$fName";
+ #}
+
if(!open(FH, ">$fName")) {
FW_pO "$fName: $!";
return;