]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
ednscookies: Fix timestamp validity check 17384/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 15 May 2026 14:20:18 +0000 (16:20 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 15 May 2026 14:20:18 +0000 (16:20 +0200)
I _think_ the check was wrong, but please double-check my logic.

Signed-off-by: Remi Gacogne <remi.gacogne@powerdns.com>
pdns/ednscookies.cc

index b6c355f1940e2d2dc56ffdf84ac4a101922458ab..88b6830c63733b08b84ffecb1534dafb0cd437dc 100644 (file)
@@ -109,8 +109,8 @@ static bool cookieTSIsValid(uint32_t timestamp, uint32_t now)
   //    The DNS server
   //    SHOULD allow cookies within a 1-hour period in the past and a
   //    5-minute period into the future
-  // valid: now - 300 < timestamp < now + 3600
-  return rfc1982LessThan(now - 300, timestamp) && rfc1982LessThan(timestamp, now + 3600);
+  // valid: now - 3600 < timestamp < now + 300
+  return rfc1982LessThan(now - 3600, timestamp) && rfc1982LessThan(timestamp, now + 300);
 }
 
 bool EDNSCookiesOpt::isValid([[maybe_unused]] const string& secret, [[maybe_unused]] const ComboAddress& source) const