diff options
author | Erwin Lansing <erwin@FreeBSD.org> | 2014-12-15 12:14:41 +0000 |
---|---|---|
committer | Erwin Lansing <erwin@FreeBSD.org> | 2014-12-15 12:14:41 +0000 |
commit | 4c9547cd12b5bb569f10b368eb6bb04d897d596f (patch) | |
tree | 025b1191fa4f9c03bf5345071dd2658f5d240b69 /lib/dns/time.c | |
parent | 989b3b2d6068ce5b525479b7754977baf6364a7d (diff) |
Notes
Diffstat (limited to 'lib/dns/time.c')
-rw-r--r-- | lib/dns/time.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/dns/time.c b/lib/dns/time.c index d331ca3bfe10..5dce07281195 100644 --- a/lib/dns/time.c +++ b/lib/dns/time.c @@ -35,7 +35,7 @@ #include <dns/result.h> #include <dns/time.h> -static int days[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; +static const int days[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; isc_result_t dns_time64_totext(isc_int64_t t, isc_buffer_t *target) { @@ -161,6 +161,14 @@ dns_time64_fromtext(const char *source, isc_int64_t *target) { RANGE(1, 12, month); RANGE(1, days[month - 1] + ((month == 2 && is_leap(year)) ? 1 : 0), day); +#ifdef __COVERITY__ + /* + * Use a simplified range to silence Coverity warning (in + * arithmetic with day below). + */ + RANGE(1, 31, day); +#endif /* __COVERITY__ */ + RANGE(0, 23, hour); RANGE(0, 59, minute); RANGE(0, 60, second); /* 60 == leap second. */ |