Bug 29403: Match the whole string
This patch wraps the constructed regex such that we expect the entire regex to match and don't allow leading or trailing garbage. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
b09e3e99b7
commit
62652115dc
1 changed files with 4 additions and 0 deletions
|
@ -162,6 +162,10 @@ sub dt_from_string {
|
|||
$regex .= $time_re unless ( $date_format eq 'rfc3339' );
|
||||
$fallback_re .= $time_re;
|
||||
|
||||
# Ensure we only accept date strings and not other characters.
|
||||
$regex = '^' . $regex . '$';
|
||||
$fallback_re = '^' . $fallback_re . '$';
|
||||
|
||||
my %dt_params;
|
||||
my $ampm;
|
||||
if ( $date_string =~ $regex ) {
|
||||
|
|
Loading…
Reference in a new issue