summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar René Scharfe <l.s.r@web.de>2014-11-15 14:27:21 +0100
committerLibravatar Junio C Hamano <gitster@pobox.com>2014-11-17 08:57:07 -0800
commit31a8aa1ee84f4fba7597b0fa2e99f94596c079bb (patch)
tree392314094cd252de73c2e3e47b0a8ee8c3449442
parentreceive-pack::hmac_sha1(): copy the entire SHA-1 hash out (diff)
downloadtgif-31a8aa1ee84f4fba7597b0fa2e99f94596c079bb.tar.xz
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>
-rw-r--r--builtin/receive-pack.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index 42f25a5103..a38ea7ddb3 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -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)