mirror of
https://github.com/Maschell/fuse-wiiu.git
synced 2024-11-22 06:39:14 +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;
|
||||
}
|
||||
|
||||
if(size > Integer.MAX_VALUE) {
|
||||
System.err.println("Request read size was too big.");
|
||||
return -ErrorCodes.EIO();
|
||||
}
|
||||
|
||||
try {
|
||||
byte[] data = getDataProvider().readFile(entry, offset, size);
|
||||
|
||||
|
@ -198,13 +198,18 @@ public class NUSTitleEncryptedFuseContainer implements FuseContainer {
|
||||
return -ErrorCodes.EISDIR();
|
||||
}
|
||||
|
||||
if(size > Integer.MAX_VALUE) {
|
||||
System.err.println("Request read size was too big.");
|
||||
return -ErrorCodes.EIO();
|
||||
}
|
||||
|
||||
path = path.substring(1);
|
||||
|
||||
Optional<Content> coOptional = getContentForPath(path);
|
||||
if (coOptional.isPresent()) {
|
||||
Content c = coOptional.get();
|
||||
if (offset >= c.getEncryptedFileSize()) {
|
||||
return -ErrorCodes.ENOENT();
|
||||
return -ErrorCodes.EIO();
|
||||
}
|
||||
if (offset + size > c.getEncryptedFileSize()) {
|
||||
size = c.getEncryptedFileSize() - offset;
|
||||
@ -225,7 +230,7 @@ public class NUSTitleEncryptedFuseContainer implements FuseContainer {
|
||||
byte[] hash = h3Data.get();
|
||||
|
||||
if (offset >= hash.length) {
|
||||
return -ErrorCodes.ENOENT();
|
||||
return -ErrorCodes.EIO();
|
||||
}
|
||||
if (offset + size > hash.length) {
|
||||
size = hash.length - offset;
|
||||
|
Loading…
Reference in New Issue
Block a user