git.samba.org
/
metze
/
samba
/
wip.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3a38303
)
s3:locking: Fix integer overflow check in posix_lock_in_range()
author
Andreas Schneider
<asn@samba.org>
Thu, 7 Dec 2017 17:24:18 +0000
(18:24 +0100)
committer
Jeremy Allison
<jra@samba.org>
Tue, 20 Mar 2018 22:16:16 +0000
(23:16 +0100)
This fixes compilation with -Wstrict-overflow=2
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/locking/posix.c
patch
|
blob
|
history
diff --git
a/source3/locking/posix.c
b/source3/locking/posix.c
index ff794282114af0186121f2d50c933495ec3fb51f..0b627aaa3e58ed2190a143e3bd028653ad97115c 100644
(file)
--- 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;
}