mirror of
https://github.com/oliverschmidt/contiki.git
synced 2025-08-15 12:27:50 +00:00
Trailing zeros in file leading to unexpected file length get set in destination buffer
This commit is contained in:
@@ -1098,8 +1098,8 @@ cfs_read(int fd, void *buf, unsigned size)
|
|||||||
|
|
||||||
fdp = &coffee_fd_set[fd];
|
fdp = &coffee_fd_set[fd];
|
||||||
file = fdp->file;
|
file = fdp->file;
|
||||||
if(fdp->offset + size > file->end) {
|
while(fdp->offset + size > file->end) {
|
||||||
size = file->end - fdp->offset;
|
((char*)buf)[--size] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the file is not modified, read directly from the file extent. */
|
/* If the file is not modified, read directly from the file extent. */
|
||||||
|
Reference in New Issue
Block a user