1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

s3:locking: Fix integer overflow check in posix_lock_in_range()

This fixes compilation with -Wstrict-overflow=2

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Andreas Schneider 2017-12-07 18:24:18 +01:00 committed by Jeremy Allison
parent 3a383038ee
commit 9f6de82ef2

View File

@ -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;
}