diff options
author | ae <ae@FreeBSD.org> | 2016-01-11 18:11:06 +0000 |
---|---|---|
committer | ae <ae@FreeBSD.org> | 2016-01-11 18:11:06 +0000 |
commit | 8c83f312768355e6ac0a39475c40f17ceaaaaaa5 (patch) | |
tree | e8617ec136becb7301a5a280b065450da616afbe /sys/fs/smbfs/smbfs_vnops.c | |
parent | b5abcf3a8880919bc27f5e87b5b9a35db3adff96 (diff) | |
download | FreeBSD-src-8c83f312768355e6ac0a39475c40f17ceaaaaaa5.zip FreeBSD-src-8c83f312768355e6ac0a39475c40f17ceaaaaaa5.tar.gz |
Change the type of newsize argument in the smbfs_smb_setfsize() function
from int to int64.
MSDN says that SMB_SET_FILE_END_OF_FILE_INFO uses signed 64-bit integer
to specify offset, but since smbfs_smb_setfsize() has used plain int,
a value was truncated in case when offset was larger than 2G.
https://msdn.microsoft.com/en-us/library/ff469975.aspx
In particular, now `truncate -s 10G` will work correctly on the mounted
SMB share.
Reported and tested by: Eugene Grosbein <eugen at grosbein dot net>
MFC after: 1 week
Diffstat (limited to 'sys/fs/smbfs/smbfs_vnops.c')
-rw-r--r-- | sys/fs/smbfs/smbfs_vnops.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/fs/smbfs/smbfs_vnops.c b/sys/fs/smbfs/smbfs_vnops.c index 8ea1198..c78ceb2 100644 --- a/sys/fs/smbfs/smbfs_vnops.c +++ b/sys/fs/smbfs/smbfs_vnops.c @@ -358,7 +358,8 @@ smbfs_setattr(ap) doclose = 1; } if (error == 0) - error = smbfs_smb_setfsize(np, vap->va_size, scred); + error = smbfs_smb_setfsize(np, + (int64_t)vap->va_size, scred); if (doclose) smbfs_smb_close(ssp, np->n_fid, NULL, scred); if (error) { |