From a569e16584642f20c190140d366b8eb34f4576a7 Mon Sep 17 00:00:00 2001 From: Olaf Bergmann Date: Fri, 3 Nov 2017 14:29:49 +0100 Subject: [PATCH] coap_time.h: cast COAP_TICKS_PER_SECOND to coap_tick_t for type safety CID 1458396 detected by Coverity scan points out that integer arithmetics may lead to an overflow without the typecast to coap_tick_t. --- include/coap/coap_time.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/coap/coap_time.h b/include/coap/coap_time.h index 9585c1f8..05f64bf8 100644 --- a/include/coap/coap_time.h +++ b/include/coap/coap_time.h @@ -97,7 +97,7 @@ typedef time_t coap_time_t; typedef int64_t coap_tick_diff_t; /** Use ms resolution on POSIX systems */ -#define COAP_TICKS_PER_SECOND 1000 +#define COAP_TICKS_PER_SECOND ((coap_tick_t)(1000U)) /** * Initializes the internal clock.