mirror of
https://github.com/vgough/encfs.git
synced 2024-11-21 23:43:26 +01:00
Handle flawlessly up to MAX(int) in read/write
This commit is contained in:
parent
228ebf354e
commit
00472dfdd0
@ -715,8 +715,7 @@ int encfs_read(const char *path, char *buf, size_t size, off_t offset,
|
|||||||
// Unfortunately we have to convert from ssize_t (pread) to int (fuse), so
|
// Unfortunately we have to convert from ssize_t (pread) to int (fuse), so
|
||||||
// let's check this will be OK
|
// let's check this will be OK
|
||||||
if (size > std::numeric_limits<int>::max()) {
|
if (size > std::numeric_limits<int>::max()) {
|
||||||
RLOG(ERROR) << "tried to read too much data: " << size;
|
size = std::numeric_limits<int>::max();
|
||||||
return -EIO;
|
|
||||||
}
|
}
|
||||||
return withFileNode("read", path, file,
|
return withFileNode("read", path, file,
|
||||||
bind(_do_read, _1, (unsigned char *)buf, size, offset));
|
bind(_do_read, _1, (unsigned char *)buf, size, offset));
|
||||||
@ -744,8 +743,7 @@ int encfs_write(const char *path, const char *buf, size_t size, off_t offset,
|
|||||||
// Unfortunately we have to convert from ssize_t (pwrite) to int (fuse), so
|
// Unfortunately we have to convert from ssize_t (pwrite) to int (fuse), so
|
||||||
// let's check this will be OK
|
// let's check this will be OK
|
||||||
if (size > std::numeric_limits<int>::max()) {
|
if (size > std::numeric_limits<int>::max()) {
|
||||||
RLOG(ERROR) << "tried to write too much data: " << size;
|
size = std::numeric_limits<int>::max();
|
||||||
return -EIO;
|
|
||||||
}
|
}
|
||||||
EncFS_Context *ctx = context();
|
EncFS_Context *ctx = context();
|
||||||
if (isReadOnly(ctx)) {
|
if (isReadOnly(ctx)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user