X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/300f3739cfe93d10a867a778a1430068c00c32a8..7b9d1666e389bfedba43b2d0fd5d1b0e3f129e88:/SL/Form.pm diff --git a/SL/Form.pm b/SL/Form.pm index 4db9e4bd4..582d2aff8 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -1172,17 +1172,12 @@ sub parse_amount { } $amount =~ s/,//g; - # make shure no code wich is not a math expression ends in eval() - - $amount =~ s/\s//g; - - unless($amount =~ /^[-\+]?\d+\.?\d*([-\+\*\/][-\+]?\d+\.?\d*)*$/){ - return 0; - } $main::lxdebug->leave_sub(2); - return (eval $amount) * 1 ; + # Make sure no code wich is not a math expression ends up in eval(). + return 0 unless $amount =~ /^ [\s \d \( \) \- \+ \* \/ \. ]* $/x; + return scalar(eval($amount)) * 1 ; } sub round_amount {