[tz] [PATCH] POSIX TZ string validation bug

J William Piggott elseifthen at gmx.com
Wed Mar 2 01:59:57 UTC 2016


Invalid Julian date of J00 passes.

POSIX indicates that there should be no zero padding on 'Julian' dates:
Jn The Julian day n (1 <= n <= 365).
 n The zero-based Julian day (0 <= n <= 365).

* tzselect.ksh: Implement this.

Signed-off-by: J William Piggott <elseifthen at gmx.com>
---
 tzselect.ksh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tzselect.ksh b/tzselect.ksh
index ba763e7..d2c3a6d 100644
--- a/tzselect.ksh
+++ b/tzselect.ksh
@@ -351,8 +351,8 @@ while
 				  "(:[0-5][0-9](:[0-5][0-9])?)?"
 				offset = "[-+]?" time
 				mdate = "M([1-9]|1[0-2])\\.[1-5]\\.[0-6]"
-				jdate = "((J[1-9]|[0-9]|J?[1-2]?[0-9][0-9])" \
-				  "|J?3[0-5][0-9]|J?36[0-5])"
+				jdate = "((J[1-9]|[0-9]|J?[1-9][0-9]" \
+				  "|J?[1-2][0-9][0-9])|J?3[0-5][0-9]|J?36[0-5])"
 				datetime = ",(" mdate "|" jdate ")(/" time ")?"
 				tzpattern = "^(:.*|" tzname offset "(" tzname \
 				  "(" offset ")?(" datetime datetime ")?)?)$"



More information about the tz mailing list