mirror of
https://git.FreeBSD.org/ports.git
synced 2024-10-22 20:41:26 +00:00
Fix a possible-corruption-at-end-of-file bug.
PR: ports/30120 Submitted by: Scott Renfro <scott@renfro.org>
This commit is contained in:
parent
6d296b1b3c
commit
1976a26400
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=49339
16
security/cfs/files/patch-cfs_fh.c
Normal file
16
security/cfs/files/patch-cfs_fh.c
Normal file
@ -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);
|
||||
}
|
Loading…
Reference in New Issue
Block a user