From cd8bdb8f4908d1abf58a18532a3cfec1b66e6d5c Mon Sep 17 00:00:00 2001 From: BTChip github Date: Sun, 24 Mar 2019 21:56:30 +0100 Subject: [PATCH] Add space to ERC 20 ticker --- src/main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index 082dc8b..be94b2b 100644 --- a/src/main.c +++ b/src/main.c @@ -2277,7 +2277,7 @@ void handleProvideErc20TokenInformation(uint8_t p1, uint8_t p2, uint8_t *workBuf } tickerLength = workBuffer[offset++]; dataLength--; - if (tickerLength >= sizeof(tmpCtx.transactionContext.currentToken.ticker)) { + if ((tickerLength + 1) >= sizeof(tmpCtx.transactionContext.currentToken.ticker)) { THROW(0x6A80); } if (dataLength < tickerLength + 20 + 4 + 4) { @@ -2285,7 +2285,8 @@ void handleProvideErc20TokenInformation(uint8_t p1, uint8_t p2, uint8_t *workBuf } cx_hash_sha256(workBuffer + offset, tickerLength + 20 + 4 + 4, hash); os_memmove(tmpCtx.transactionContext.currentToken.ticker, workBuffer + offset, tickerLength); - tmpCtx.transactionContext.currentToken.ticker[tickerLength] = '\0'; + tmpCtx.transactionContext.currentToken.ticker[tickerLength] = ' '; + tmpCtx.transactionContext.currentToken.ticker[tickerLength + 1] = '\0'; offset += tickerLength; dataLength -= tickerLength; os_memmove(tmpCtx.transactionContext.currentToken.address, workBuffer + offset, 20);