Fix usbhid-dump SIGSEGV on #100
This commit is contained in:
parent
dde2993223
commit
0f60c3896c
|
@ -161,9 +161,10 @@ Report::Report(Report::Type type, DeviceIndex device_index,
|
||||||
(sw_id & 0x0f);
|
(sw_id & 0x0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
Report::Report(const std::vector<uint8_t>& data)
|
Report::Report(const std::vector<uint8_t>& data) :
|
||||||
|
_data (data)
|
||||||
{
|
{
|
||||||
_data = data;
|
_data.resize(HeaderLength + LongParamLength);
|
||||||
|
|
||||||
// Truncating data is entirely valid here.
|
// Truncating data is entirely valid here.
|
||||||
switch(_data[Offset::Type]) {
|
switch(_data[Offset::Type]) {
|
||||||
|
|
|
@ -262,6 +262,9 @@ std::vector<uint8_t> RawDevice::_respondToReport
|
||||||
throw TimeoutError();
|
throw TimeoutError();
|
||||||
_readReport(response, MAX_DATA_LENGTH, timeout);
|
_readReport(response, MAX_DATA_LENGTH, timeout);
|
||||||
|
|
||||||
|
if(!_continue_respond)
|
||||||
|
throw TimeoutError();
|
||||||
|
|
||||||
// All reports have the device index at byte 2
|
// All reports have the device index at byte 2
|
||||||
if(response[1] != request[1]) {
|
if(response[1] != request[1]) {
|
||||||
if(_continue_listen)
|
if(_continue_listen)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user