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
@ -116,6 +116,11 @@ public class FSTDataProviderContainer implements FuseContainer {
|
|||||||
if (offset + size > entry.getFileSize()) {
|
if (offset + size > entry.getFileSize()) {
|
||||||
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);
|
||||||
|
@ -197,6 +197,11 @@ public class NUSTitleEncryptedFuseContainer implements FuseContainer {
|
|||||||
if (path.equals("/")) {
|
if (path.equals("/")) {
|
||||||
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);
|
||||||
|
|
||||||
@ -204,7 +209,7 @@ public class NUSTitleEncryptedFuseContainer implements FuseContainer {
|
|||||||
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