Skip to content

Commit 31a8aa1

Browse files
rscharfegitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6f5ef44 commit 31a8aa1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

builtin/receive-pack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ static const char *check_nonce(const char *buf, size_t len)
429429
nonce_stamp_slop = (long)ostamp - (long)stamp;
430430

431431
if (nonce_stamp_slop_limit &&
432-
abs(nonce_stamp_slop) <= nonce_stamp_slop_limit) {
432+
labs(nonce_stamp_slop) <= nonce_stamp_slop_limit) {
433433
/*
434434
* Pretend as if the received nonce (which passes the
435435
* HMAC check, so it is not a forged by third-party)

0 commit comments

Comments
 (0)