krb5: avoid time-difference overflow
Use krb5_time_abs() rather than subtracting time_t values before passing the result to labs(). On signed 32-bit time_t platforms, subtracting far-apart times can overflow before labs() sees the value.
This commit is contained in:
committed by
Nico Williams
parent
fdeb3e6e4e
commit
f609aae209
@@ -57,8 +57,8 @@ check_set_time(krb5_context context)
|
||||
diff2 = krb5_time_abs(sec, tv.tv_sec);
|
||||
|
||||
if (diff2 < 9 || diff > 11)
|
||||
krb5_errx(context, 1, "set time error: diff: %ld",
|
||||
krb5_time_abs(sec, tv.tv_sec));
|
||||
krb5_errx(context, 1, "set time error: diff: %lld",
|
||||
(long long)krb5_time_abs(sec, tv.tv_sec));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user