]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: guid_128_generate() shouldn't generate invalid timestamps
authorJosef 'Jeff' Sipek <jeff.sipek@dovecot.fi>
Mon, 5 Jun 2017 09:55:56 +0000 (12:55 +0300)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Fri, 9 Jun 2017 07:40:14 +0000 (10:40 +0300)
The nsec validity check must take into account the soon-to-be-done increment.

src/lib/guid.c

index ee9482ecdea39d491332c55e410c377f9ac094dc..27f0e35d040babdeb52e12c7606a125e1d99d796 100644 (file)
@@ -75,7 +75,7 @@ void guid_128_generate(guid_128_t guid_r)
                   when a GUID was created. */
                ts.tv_sec = ioloop_timeval.tv_sec;
                ts.tv_nsec = ioloop_timeval.tv_usec*1000;
-       } else if ((uint32_t)ts.tv_nsec < 1000000000) {
+       } else if (ts.tv_nsec < 999999999L) {
                ts.tv_nsec++;
        } else {
                ts.tv_sec++;