From 34de7bc267984340d0c6c0afcbb1069af2f81e6d Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Sat, 23 Jun 2018 15:43:31 +0100 Subject: [PATCH] device_ledger: fix buffer underflow on bad data from device --- src/device/device_ledger.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/device/device_ledger.cpp b/src/device/device_ledger.cpp index 8735baeb6..bc7f37789 100644 --- a/src/device/device_ledger.cpp +++ b/src/device/device_ledger.cpp @@ -304,6 +304,7 @@ namespace hw { SCARD_PCI_T0, this->buffer_send, this->length_send, NULL, this->buffer_recv, &this->length_recv); ASSERT_RV(rv); + ASSERT_T0(this->length_recv >= 2); ASSERT_T0(this->length_recv <= BUFFER_RECV_SIZE); logRESP();