This commit fixes the following POSIX TZ validation bugs in tzselect.ksh. Did not allow: TZ name quoting (<, >): TZ="<EST+5>5" Allowed: TZ name == Non-alpha characters: TZ="E!T5" Time > 24 hours Julian date == J0 Julian date > J365 Julian date > 365 Month date > M12.x.x Month date > Mx.5.x Month date > Mx.x.6 Month date < M1.x.x Month date < Mx.1.x Signed-off-by: J William Piggott <elseifthen@gmx.com> --- tzselect.ksh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tzselect.ksh b/tzselect.ksh index df5621f..10570b6 100644 --- a/tzselect.ksh +++ b/tzselect.ksh @@ -346,11 +346,14 @@ while 'that is 10 hours ahead (east) of UTC.' read TZ $AWK -v TZ="$TZ" 'BEGIN { - tzname = "[^-+,0-9][^-+,0-9][^-+,0-9]+" - time = "[0-2]?[0-9](:[0-5][0-9](:[0-5][0-9])?)?" + tzname = "(<[[:alnum:]+-]{3,}>|[[:alpha:]]{3,})" + time = "(2[0-4]|[0-1]?[0-9])" \ + "(:[0-5][0-9](:[0-5][0-9])?)?" offset = "[-+]?" time - date = "(J?[0-9]+|M[0-9]+\\.[0-9]+\\.[0-9]+)" - datetime = "," date "(/" 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])" + datetime = ",(" mdate "|" jdate ")(/" time ")?" tzpattern = "^(:.*|" tzname offset "(" tzname \ "(" offset ")?(" datetime datetime ")?)?)$" if (TZ ~ tzpattern) exit 1