aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFrançois Colas <francois.colas@ledger.fr>2020-05-27 14:57:05 +0200
committerFrançois Colas <francois.colas@ledger.fr>2020-05-27 18:06:19 +0200
commitec46069248a8f38aed9d07277a1c253e6cd2f02f (patch)
tree1939dda1636937561639ef29d0632046802b7cfa /src
parentMerge pull request #6510 (diff)
downloadmonero-ec46069248a8f38aed9d07277a1c253e6cd2f02f.tar.xz
Fix incorrect lenght of command INS_PREFIX_HASH
buffer_send[4] (LC) is an unsigned char, len should not exceed 254 (255 - 1 for the option).
Diffstat (limited to 'src')
-rw-r--r--src/device/device_ledger.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/device/device_ledger.cpp b/src/device/device_ledger.cpp
index 222a84d3f..0783b00b0 100644
--- a/src/device/device_ledger.cpp
+++ b/src/device/device_ledger.cpp
@@ -1468,8 +1468,8 @@ namespace hw {
offset = set_command_header(INS_PREFIX_HASH,2,cnt);
len = pref_length - pref_offset;
//options
- if (len > (BUFFER_SEND_SIZE-7)) {
- len = BUFFER_SEND_SIZE-7;
+ if (len > (BUFFER_SEND_SIZE-offset-3)) {
+ len = BUFFER_SEND_SIZE-offset-3;
this->buffer_send[offset] = 0x80;
} else {
this->buffer_send[offset] = 0x00;