From 9f6de82ef25c5d7969c3986d508a138c3c4f5a64 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 7 Dec 2017 18:24:18 +0100 Subject: [PATCH] s3:locking: Fix integer overflow check in posix_lock_in_range() This fixes compilation with -Wstrict-overflow=2 Signed-off-by: Andreas Schneider Reviewed-by: Andrew Bartlett --- source3/locking/posix.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source3/locking/posix.c b/source3/locking/posix.c index ff794282114..0b627aaa3e5 100644 --- a/source3/locking/posix.c +++ b/source3/locking/posix.c @@ -145,7 +145,8 @@ static bool posix_lock_in_range(off_t *offset_out, off_t *count_out, * Truncate count to end at max lock offset. */ - if (offset + count < 0 || offset + count > max_positive_lock_offset) { + if (offset > INT64_MAX - count || + offset + count > max_positive_lock_offset) { count = max_positive_lock_offset - offset; } -- 2.11.4.GIT