Trailing zeros in file leading to unexpected file length get set in destination buffer

This commit is contained in:
Frank Freihube 2016-04-27 10:39:05 +02:00
parent 37f0931c02
commit 7ba5b0d150

View File

@ -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. */