mirror of
https://github.com/akuker/RASCSI.git
synced 2024-12-30 05:29:47 +00:00
Updated MODE SENSE error handling in case of an overflow (#732)
* Updated MODE SENSE error handling * Updated range check
This commit is contained in:
parent
08156f763f
commit
32fb022a41
@ -459,6 +459,11 @@ int Disk::ModeSense6(const DWORD *cdb, BYTE *buf)
|
||||
}
|
||||
size += pages_size;
|
||||
|
||||
if (size > 255) {
|
||||
SetStatusCode(STATUS_INVALIDPRM);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Do not return more than ALLOCATION LENGTH bytes
|
||||
if (size > length) {
|
||||
size = length;
|
||||
@ -541,6 +546,11 @@ int Disk::ModeSense10(const DWORD *cdb, BYTE *buf, int max_length)
|
||||
}
|
||||
size += pages_size;
|
||||
|
||||
if (size > 65535) {
|
||||
SetStatusCode(STATUS_INVALIDPRM);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Do not return more than ALLOCATION LENGTH bytes
|
||||
if (size > length) {
|
||||
size = length;
|
||||
|
Loading…
Reference in New Issue
Block a user