aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2022-09-18 11:51:03 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2022-10-08 00:29:35 +0000
commit27ec1f0833a153c4052c74e0863c556057735b26 (patch)
tree387a1a302b39db7a91b609094bdaf4ba81e73de6
parent3936744da50c0f10466780305208f61542131898 (diff)
downloadsrc-27ec1f0833a153c4052c74e0863c556057735b26.tar.gz
src-27ec1f0833a153c4052c74e0863c556057735b26.zip
msdosfs: disallow truncation to set file size past RLIMIT_FSIZE
PR: 164793 (cherry picked from commit 701b73858e3afa15d8ca2ea4aa480173ccc5960e)
-rw-r--r--sys/fs/msdosfs/msdosfs_vnops.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c
index 86af14784f5b..b9f1b678e534 100644
--- a/sys/fs/msdosfs/msdosfs_vnops.c
+++ b/sys/fs/msdosfs/msdosfs_vnops.c
@@ -460,6 +460,9 @@ msdosfs_setattr(struct vop_setattr_args *ap)
*/
break;
}
+ error = vn_rlimit_trunc(vap->va_size, td);
+ if (error != 0)
+ return (error);
error = detrunc(dep, vap->va_size, 0, cred);
if (error)
return error;