mirror of
https://github.com/Maschell/fuse-wiiu.git
synced 2024-11-25 15:56:53 +01:00
Add size check for the read() function
This commit is contained in:
parent
5e05c65efd
commit
2c3a5332a4
@ -117,6 +117,11 @@ public class FSTDataProviderContainer implements FuseContainer {
|
|||||||
size = entry.getFileSize() - offset;
|
size = entry.getFileSize() - offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(size > Integer.MAX_VALUE) {
|
||||||
|
System.err.println("Request read size was too big.");
|
||||||
|
return -ErrorCodes.EIO();
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
byte[] data = getDataProvider().readFile(entry, offset, size);
|
byte[] data = getDataProvider().readFile(entry, offset, size);
|
||||||
|
|
||||||
|
@ -198,13 +198,18 @@ public class NUSTitleEncryptedFuseContainer implements FuseContainer {
|
|||||||
return -ErrorCodes.EISDIR();
|
return -ErrorCodes.EISDIR();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(size > Integer.MAX_VALUE) {
|
||||||
|
System.err.println("Request read size was too big.");
|
||||||
|
return -ErrorCodes.EIO();
|
||||||
|
}
|
||||||
|
|
||||||
path = path.substring(1);
|
path = path.substring(1);
|
||||||
|
|
||||||
Optional<Content> coOptional = getContentForPath(path);
|
Optional<Content> coOptional = getContentForPath(path);
|
||||||
if (coOptional.isPresent()) {
|
if (coOptional.isPresent()) {
|
||||||
Content c = coOptional.get();
|
Content c = coOptional.get();
|
||||||
if (offset >= c.getEncryptedFileSize()) {
|
if (offset >= c.getEncryptedFileSize()) {
|
||||||
return -ErrorCodes.ENOENT();
|
return -ErrorCodes.EIO();
|
||||||
}
|
}
|
||||||
if (offset + size > c.getEncryptedFileSize()) {
|
if (offset + size > c.getEncryptedFileSize()) {
|
||||||
size = c.getEncryptedFileSize() - offset;
|
size = c.getEncryptedFileSize() - offset;
|
||||||
@ -225,7 +230,7 @@ public class NUSTitleEncryptedFuseContainer implements FuseContainer {
|
|||||||
byte[] hash = h3Data.get();
|
byte[] hash = h3Data.get();
|
||||||
|
|
||||||
if (offset >= hash.length) {
|
if (offset >= hash.length) {
|
||||||
return -ErrorCodes.ENOENT();
|
return -ErrorCodes.EIO();
|
||||||
}
|
}
|
||||||
if (offset + size > hash.length) {
|
if (offset + size > hash.length) {
|
||||||
size = hash.length - offset;
|
size = hash.length - offset;
|
||||||
|
Loading…
Reference in New Issue
Block a user