Bugzilla – Attachment 128451 Details for
Bug 29403
dt_from_string should fail if passed more data than expected for the format
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29403: Match the whole string
Bug-29403-Match-the-whole-string.patch (text/plain), 1.02 KB, created by
Jonathan Druart
on 2021-12-13 11:58:21 UTC
(
hide
)
Description:
Bug 29403: Match the whole string
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2021-12-13 11:58:21 UTC
Size:
1.02 KB
patch
obsolete
>From 43b278108121d6a3b73744f523681b1f9fc36a72 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 3 Nov 2021 12:15:18 +0000 >Subject: [PATCH] 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> >--- > Koha/DateUtils.pm | 4 ++++ > 1 file changed, 4 insertions(+) > >diff --git a/Koha/DateUtils.pm b/Koha/DateUtils.pm >index ad242b59eb1..c4120b8c8fe 100644 >--- a/Koha/DateUtils.pm >+++ b/Koha/DateUtils.pm >@@ -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 ) { >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 29403
:
127246
|
127247
|
127254
|
128076
|
128077
|
128078
|
128272
|
128273
|
128274
|
128450
|
128451
|
128452
|
128825
|
128826
|
128827
|
128828
|
128829
|
129373
|
129374
|
129375
|
129376
|
129391
|
129392
|
129393
|
129394
|
129473
|
129486
|
129487
|
129488
|
129552
|
129553
|
129554
|
129555
|
129556