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