diff options
author | Andrew Tridgell <tridge@samba.org> | 1998-12-07 22:43:43 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 1998-12-07 22:43:43 +0000 |
commit | 5e2844d5edb15de29b976d2ff077ffbe012b860c (patch) | |
tree | e27e4cb43ba188a7c48f8332d2837621c27b8bcb | |
parent | 4f85105578fdf74d883f185f983e608112fe823b (diff) | |
download | samba-5e2844d5edb15de29b976d2ff077ffbe012b860c.tar.gz samba-5e2844d5edb15de29b976d2ff077ffbe012b860c.tar.xz samba-5e2844d5edb15de29b976d2ff077ffbe012b860c.zip |
fixed warnings (and potential errors) due to integer overflow when
creating locking masks
-rw-r--r-- | source/lib/util.c | 5 | ||||
-rw-r--r-- | source/smbd/open.c | 3 |
2 files changed, 5 insertions, 3 deletions
diff --git a/source/lib/util.c b/source/lib/util.c index 904b007749f..e5ddda18916 100644 --- a/source/lib/util.c +++ b/source/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 */ diff --git a/source/smbd/open.c b/source/smbd/open.c index dd1ece7fe13..6658b8926f8 100644 --- a/source/smbd/open.c +++ b/source/smbd/open.c @@ -574,7 +574,8 @@ static void truncate_unless_locked(files_struct *fsp, connection_struct *conn, i BOOL *share_locked) { if (fsp->can_write){ - 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); if (is_locked(fsp,conn,~mask,0,F_WRLCK)){ /* If share modes are in force for this connection we |