From 511c23bb502be94ecef16fecb85604d8f70f52ec Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Tue, 1 Apr 2014 15:01:34 +0000 Subject: [PATCH] FileLog: better regexp checking git-svn-id: https://svn.fhem.de/fhem/trunk@5400 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/92_FileLog.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fhem/FHEM/92_FileLog.pm b/fhem/FHEM/92_FileLog.pm index b4c15273a..7b3a0d2f7 100755 --- a/fhem/FHEM/92_FileLog.pm +++ b/fhem/FHEM/92_FileLog.pm @@ -57,6 +57,7 @@ FileLog_Define($@) return "wrong syntax: define FileLog filename regexp" if(int(@a) != 4); + return "Bad regexp: starting with *" if($re =~ m/^\*/); eval { "Hallo" =~ m/^$a[3]$/ }; return "Bad regexp: $@" if($@); @@ -215,6 +216,7 @@ FileLog_Set($@) map { $h{$_} = 1 } split(/\|/, $hash->{REGEXP}); $h{$re} = 1; $re = join("|", sort keys %h); + return "Bad regexp: starting with *" if($re =~ m/^\*/); eval { "Hallo" =~ m/^$re$/ }; return "Bad regexp: $@" if($@); $hash->{REGEXP} = $re; @@ -228,6 +230,7 @@ FileLog_Set($@) return "Cannot remove last regexp part" if(int(keys(%h)) == 1); delete $h{$a[2]}; my $re = join("|", sort keys %h); + return "Bad regexp: starting with *" if($re =~ m/^\*/); eval { "Hallo" =~ m/^$re$/ }; return "Bad regexp: $@" if($@); $hash->{REGEXP} = $re;