mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 17:38:35 +02:00
VSA: Fix incorrect bytesRead value for end of overlapped buffer
This commit is contained in:
committed by
Kyle Schwarz
parent
b9d3dde8d5
commit
a5ec9a2d20
+10
-2
@@ -3315,10 +3315,18 @@ std::optional<uint64_t> Device::vsaReadLogicalDisk(uint64_t pos, uint8_t* into,
|
|||||||
return readLogicalDisk(pos, into, amount);
|
return readLogicalDisk(pos, into, amount);
|
||||||
}
|
}
|
||||||
uint64_t firstReadAmount = diskSize - pos;
|
uint64_t firstReadAmount = diskSize - pos;
|
||||||
if(!readLogicalDisk(pos, into, firstReadAmount)) {
|
uint64_t bytesRead = 0;
|
||||||
|
if(auto optBytesReadFirst = readLogicalDisk(pos, into, firstReadAmount)) {
|
||||||
|
bytesRead = *optBytesReadFirst;
|
||||||
|
} else {
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
return readLogicalDisk(VSA::RecordStartOffset, into + firstReadAmount, amount - firstReadAmount);
|
if(auto optBytesReadSecond = readLogicalDisk(VSA::RecordStartOffset, into + firstReadAmount, amount - firstReadAmount)) {
|
||||||
|
bytesRead += *optBytesReadSecond;
|
||||||
|
} else {
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
return bytesRead;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Device::dispatchVSAMessages(VSAParser& parser) {
|
bool Device::dispatchVSAMessages(VSAParser& parser) {
|
||||||
|
|||||||
Reference in New Issue
Block a user