All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukas Straub <lukasstraub2@web.de>
To: netfilter-devel@vger.kernel.org
Subject: [PATCH nft] meta time: use uint64_t instead of time_t
Date: Tue, 5 Apr 2022 10:41:14 +0000	[thread overview]
Message-ID: <20220405101026.867817071@web.de> (raw)
In-Reply-To: <20220405101016.855221490@web.de>

[-- Attachment #1: Type: text/plain, Size: 836 bytes --]

time_t may be 32 bit on some platforms and thus can't fit a timestamp
with nanoseconds resolution. This causes overflows and ultimatively
breaks meta time expressions on such platforms.

Fix this by using uint64_t instead.

Closes: https://bugzilla.netfilter.org/show_bug.cgi?id=1567
Fixes: f8f32deda31df597614d9f1f64ffb0c0320f4d54 
("meta: Introduce new conditions 'time', 'day' and 'hour'")
Signed-off-by: Lukas Straub <lukasstraub2@web.de>

Index: b/src/meta.c
===================================================================
--- a/src/meta.c
+++ b/src/meta.c
@@ -444,7 +444,7 @@ static struct error_record *date_type_pa
 					    struct expr **res)
 {
 	const char *endptr = sym->identifier;
-	time_t tstamp;
+	uint64_t tstamp;
 
 	if ((tstamp = parse_iso_date(sym->identifier)) != -1)
 		goto success;


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

       reply	other threads:[~2022-04-05 11:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20220405101016.855221490@web.de>
2022-04-05 10:41 ` Lukas Straub [this message]
2022-04-05 11:58   ` [PATCH nft] meta time: use uint64_t instead of time_t Pablo Neira Ayuso
2022-04-05 13:28   ` Phil Sutter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220405101026.867817071@web.de \
    --to=lukasstraub2@web.de \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.