From: Antonio Quartulli Date: Thu, 1 Nov 2018 00:01:24 +0800 Message-Id: <20181031160124.26972-1-a@...2181...> MIME-Version: 1.0 Subject: [Openvpn-devel] [PATCH] tls-crypt: properly cast time_t to uint64_t List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit To: openvpn-devel@lists.sourceforge.net Cc: Antonio Quartulli The exact type of time_t is platform dependent and therefore can't be assumed to be uint64_t all the time. For example, on 32bit platforms, where time_t is defined as long (32bit), the compiler will generate the following warning, due to the arithmetic used in the macro: tls_crypt.c:745:29: warning: shift count >= width of type [-Wshift-count-overflow] Force time_t to be parsed as uint64_t. Reported-by: Arne Schwabe Signed-off-by: Antonio Quartulli --- src/openvpn/tls_crypt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openvpn/tls_crypt.c b/src/openvpn/tls_crypt.c index d70d0a66..c3ed2b93 100644 --- a/src/openvpn/tls_crypt.c +++ b/src/openvpn/tls_crypt.c @@ -742,7 +742,7 @@ tls_crypt_v2_write_client_key_file(const char *filename, } else { - int64_t timestamp = htonll(now); + int64_t timestamp = htonll((uint64_t)now); ASSERT(buf_write(&metadata, &TLS_CRYPT_METADATA_TYPE_TIMESTAMP, 1)); ASSERT(buf_write(&metadata, ×tamp, sizeof(timestamp))); } -- 2.19.1