From: Ben Kaduk Date: Wed, 27 Jun 2012 20:00:16 +0000 (-0400) Subject: Use consistent types for overflow comparison X-Git-Tag: krb5-1.11-alpha1~461 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e7aa25d215a9d4baa95643f2d19e44036e57af72;p=thirdparty%2Fkrb5.git 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. --- diff --git a/src/lib/kdb/kdb_log.c b/src/lib/kdb/kdb_log.c index 625c71a3ee..0153375ea7 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 *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++;