]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Use consistent types for overflow comparison
authorBen Kaduk <kaduk@mit.edu>
Wed, 27 Jun 2012 20:00:16 +0000 (16:00 -0400)
committerBen Kaduk <kaduk@mit.edu>
Tue, 3 Jul 2012 04:43:45 +0000 (00:43 -0400)
Unsigned long might not be 32-bits, in which case the overflow check
fails for a 32-bit kdb_sno_t.  Cast from -1 explicitly as a more
robust check.

src/lib/kdb/kdb_log.c

index 625c71a3ee34b686aedf23ebb84d8c51631c4914..0153375ea77f046d24e358bd16fcd776c452fc20 100644 (file)
@@ -204,7 +204,7 @@ ulog_add_update(krb5_context context, kdb_incr_update_t *upd)
      * We need to overflow our sno, replicas will do full
      * resyncs once they see their sno > than the masters.
      */
-    if (cur_sno == ULONG_MAX)
+    if (cur_sno == (kdb_sno_t)-1)
         cur_sno = 1;
     else
         cur_sno++;