From e50ab2b528a3dd176d98f95cb644fc6695c55318 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 7 Dec 1998 22:43:43 +0000 Subject: fixed warnings (and potential errors) due to integer overflow when creating locking masks (This used to be commit 5e2844d5edb15de29b976d2ff077ffbe012b860c) --- source3/lib/util.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source3/lib') diff --git a/source3/lib/util.c b/source3/lib/util.c index 904b007749..e5ddda1891 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -2666,8 +2666,8 @@ BOOL fcntl_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type) int ret; if(lp_ole_locking_compat()) { - SMB_OFF_T mask = ((SMB_OFF_T)0xC) << (SMB_OFF_T_BITS-4); SMB_OFF_T mask2= ((SMB_OFF_T)0x3) << (SMB_OFF_T_BITS-4); + SMB_OFF_T mask = (mask2<<2); /* make sure the count is reasonable, we might kill the lockd otherwise */ count &= ~mask; @@ -2679,7 +2679,8 @@ BOOL fcntl_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type) if ((offset & mask) != 0) offset = (offset & ~mask) | (((offset & mask) >> 2) & mask2); } else { - SMB_OFF_T mask = ((SMB_OFF_T)0x8) << (SMB_OFF_T_BITS-4); + SMB_OFF_T mask2 = ((SMB_OFF_T)0x4) << (SMB_OFF_T_BITS-4); + SMB_OFF_T mask = (mask2<<1); SMB_OFF_T neg_mask = ~mask; /* interpret negative counts as large numbers */ -- cgit