Check device message size
This commit is contained in:
parent
7652bb24a3
commit
2e11023096
@ -113,12 +113,17 @@ final class DeviceManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func processDeviceResponse(_ buffer: ByteBuffer) {
|
func processDeviceResponse(_ buffer: ByteBuffer) {
|
||||||
guard let data = buffer.getData(at: 0, length: buffer.readableBytes),
|
guard let data = buffer.getData(at: 0, length: buffer.readableBytes) else {
|
||||||
data.count == SignedMessage.size else {
|
|
||||||
log("Failed to get data buffer received from device")
|
log("Failed to get data buffer received from device")
|
||||||
self.resumeDeviceRequest(with: .invalidMessageSizeFromDevice)
|
self.resumeDeviceRequest(with: .invalidMessageSizeFromDevice)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
guard data.count == SignedMessage.size else {
|
||||||
|
print("Invalid size of device message: \(data.count)")
|
||||||
|
self.resumeDeviceRequest(with: .invalidMessageSizeFromDevice)
|
||||||
|
return
|
||||||
|
}
|
||||||
self.resumeDeviceRequest(with: data)
|
self.resumeDeviceRequest(with: data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user