From 63c88b1a746e77df85a241ee6d6eb726b025da3d Mon Sep 17 00:00:00 2001 From: nnposter Date: Sun, 4 Oct 2020 03:28:01 +0000 Subject: [PATCH] Avoid masked use of date before 1/1/1970 UTC. Fixes #2136, closes #2137 --- CHANGELOG | 3 +++ nselib/afp.lua | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 1e2c47097..aac9e8ab0 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,8 @@ #Nmap Changelog ($Id$); -*-text-*- +o [NSE][GH#2136][GH#2137] Rectify error "time result cannot be represented..." + in the FP library. [Clément Notin, nnposter] + o [NSE] Script mysql-audit now defaults to the bundled mysql-cis.audit for the audit rule base. [nnposter] diff --git a/nselib/afp.lua b/nselib/afp.lua index 84c26fb40..18c49c287 100644 --- a/nselib/afp.lua +++ b/nselib/afp.lua @@ -350,7 +350,9 @@ local ERROR_MSG = { [ERROR.FPCallNotSupported] = "Server does not support this command.", } -local TIME_OFFSET = os.time{year=2000, month=1, day=1, hour=0} - os.time{year=1970, month=1, day=1, hour=0} +-- Dates are shifted forward one day to avoid referencing 12/31/1969 UTC +-- when specifying 1/1/1970 (local) in a timezone that is ahead of UTC +local TIME_OFFSET = os.time({year=2000, month=1, day=2, hour=0}) - os.time({year=1970, month=1, day=2, hour=0}) -- Check if all the bits in flag are set in bitmap. local function flag_is_set(bitmap, flag)