]> 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)
committerJosef 'Jeff' Sipek <jeff.sipek@dovecot.fi>
Wed, 7 Jun 2017 10:05:23 +0000 (13:05 +0300)
The nsec validity check must take into account the soon-to-be-done increment.

src/lib/guid.c

index 0feb745a5a1055a778445299ea09d43c4421eb81..3c0cd510733b5ff756805a46d896f243c8a42b5a 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++;