diff --git a/fs/vfs/ramfs.c b/fs/vfs/ramfs.c index 8aeb5e0..f49f560 100644 --- a/fs/vfs/ramfs.c +++ b/fs/vfs/ramfs.c @@ -98,8 +98,8 @@ static ssize_t read(inode_t *inode, char *buf, size_t size, size_t offset) if (offset >= inode->file_size) return -EINVAL; - if (size + offset >= inode->file_size) - size = inode->file_size - offset - 1; + if (size + offset > inode->file_size) + size = inode->file_size - offset; memcpy(buf, inode->data + offset, size); ret = size;