Trailing zeros in file leading to unexpected file length get set in destination buffer
This commit is contained in:
parent
37f0931c02
commit
7ba5b0d150
|
@ -1098,8 +1098,8 @@ cfs_read(int fd, void *buf, unsigned size)
|
|||
|
||||
fdp = &coffee_fd_set[fd];
|
||||
file = fdp->file;
|
||||
if(fdp->offset + size > file->end) {
|
||||
size = file->end - fdp->offset;
|
||||
while(fdp->offset + size > file->end) {
|
||||
((char*)buf)[--size] = 0;
|
||||
}
|
||||
|
||||
/* If the file is not modified, read directly from the file extent. */
|
||||
|
|
Loading…
Reference in a new issue