diff options
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. */ |