krb5 commit: Use consistent types for overflow comparison

Danilo Almeida dalmeida at MIT.EDU
Fri Jul 6 20:51:46 EDT 2012


I would suggest having some internal utility functions that do
addition/subtraction/multiplication (or whatever you need) in some
k5-overflow.c (or whatever) file and call those in the main code.  Then
there is just one file you need to fix if the overflow check changes.

- Danilo

-----Original Message-----
From: cvs-krb5-bounces at MIT.EDU [mailto:cvs-krb5-bounces at MIT.EDU] On Behalf
Of Benjamin Kaduk
Sent: Monday, July 02, 2012 9:44 PM
To: cvs-krb5 at
Subject: krb5 commit: Use consistent types for overflow comparison
commit e7aa25d215a9d4baa95643f2d19e44036e57af72
Author: Ben Kaduk <kaduk at>
Date:   Wed Jun 27 16:00:16 2012 -0400

    Use consistent types for overflow comparison
    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 |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/lib/kdb/kdb_log.c b/src/lib/kdb/kdb_log.c
index 625c71a..0153375 100644
--- a/src/lib/kdb/kdb_log.c
+++ b/src/lib/kdb/kdb_log.c
@@ -204,7 +204,7 @@ ulog_add_update(krb5_context context, kdb_incr_update_t
      * 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;
cvs-krb5 mailing list
cvs-krb5 at

More information about the krbdev mailing list