aboutsummaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
authorgreen <green@FreeBSD.org>2001-10-30 03:39:39 +0800
committergreen <green@FreeBSD.org>2001-10-30 03:39:39 +0800
commit336c0334da377d29ccf25046b7fbae7a705976a7 (patch)
tree1f74d15ec472bfb2d8298c2d870ed4d59526958d /security
parent885ce0ae8e667b853461787c796ec1e4a91d51dd (diff)
downloadfreebsd-ports-gnome-336c0334da377d29ccf25046b7fbae7a705976a7.tar.gz
freebsd-ports-gnome-336c0334da377d29ccf25046b7fbae7a705976a7.tar.zst
freebsd-ports-gnome-336c0334da377d29ccf25046b7fbae7a705976a7.zip
Fix a possible-corruption-at-end-of-file bug.
PR: ports/30120 Submitted by: Scott Renfro <scott@renfro.org>
Diffstat (limited to 'security')
-rw-r--r--security/cfs/files/patch-cfs_fh.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/security/cfs/files/patch-cfs_fh.c b/security/cfs/files/patch-cfs_fh.c
new file mode 100644
index 000000000000..f474d23b7100
--- /dev/null
+++ b/security/cfs/files/patch-cfs_fh.c
@@ -0,0 +1,16 @@
+--- cfs_fh.c.orig Mon Aug 27 01:47:52 2001
++++ cfs_fh.c Mon Aug 27 01:48:41 2001
+@@ -177,6 +177,13 @@
+ perror("write");
+ return -1;
+ }
++ /* due to the way the file is padded we may actually have to
++ truncate it here. This happens when the write is at the end of
++ the file, is shorter than CFSBLOCK and brings the file to a length
++ which is evenly dividable by CFSBLOCK */
++ if (offset+len > dtov(sb.st_size) && vtod(offset+len) < sb.st_size) {
++ ftruncate(fd, vtod(offset+len));
++ }
+ /* iolen may contain CFSBLOCK extra chars */
+ return(dtov(iolen)-fronterr);
+ }