]> granicus.if.org Git - git/commitdiff
use labs() for variables of type long instead of abs()
authorRené Scharfe <l.s.r@web.de>
Sat, 15 Nov 2014 13:27:21 +0000 (14:27 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 17 Nov 2014 16:57:07 +0000 (08:57 -0800)
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>
builtin/receive-pack.c

index 42f25a5103a72486c46d7b3a584f249495dc12b4..a38ea7ddb396d0ae2a3f76b2c84223d88bf50ffb 100644 (file)
@@ -429,7 +429,7 @@ static const char *check_nonce(const char *buf, size_t len)
        nonce_stamp_slop = (long)ostamp - (long)stamp;
 
        if (nonce_stamp_slop_limit &&
-           abs(nonce_stamp_slop) <= nonce_stamp_slop_limit) {
+           labs(nonce_stamp_slop) <= nonce_stamp_slop_limit) {
                /*
                 * Pretend as if the received nonce (which passes the
                 * HMAC check, so it is not a forged by third-party)