use labs() for variables of type long instead of abs()
Using abs() on long values can cause truncation, so use labs() instead. Reported by Clang 3.5 (-Wabsolute-value, enabled by -Wall). Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe committed
Nov 15, 2014 at 14:27 UTC
31a8aa1ee84f4fba7597b0fa2e99f94596c079bb
1 file changed
+1
-1
builtin/receive-pack.c
+1
-1
@@ -429,7 +429,7 @@ static const char *check_nonce(const char *buf, size_t len)
429
nonce_stamp_slop = (long)ostamp - (long)stamp;
430
431
if (nonce_stamp_slop_limit &&
432
- abs(nonce_stamp_slop) <= nonce_stamp_slop_limit) {
432
+ labs(nonce_stamp_slop) <= nonce_stamp_slop_limit) {
433
/*
434
* Pretend as if the received nonce (which passes the
435
* HMAC check, so it is not a forged by third-party)