Skip to content

Commit

Permalink
fix potential oob writes
Browse files Browse the repository at this point in the history
  • Loading branch information
cedelavergne-ledger committed Apr 12, 2024
1 parent a27c984 commit 5b905fe
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src_common/common_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,11 @@ bool amountToString(const uint8_t *amount,
uint8_t amount_len = strnlen(tmp_buffer, sizeof(tmp_buffer));
uint8_t ticker_len = strnlen(ticker, MAX_TICKER_LEN);

memcpy(out_buffer, ticker, MIN(out_buffer_size, ticker_len));
if (ticker_len > 0) {
if (out_buffer_size <= ticker_len + 1) {
return false;
}
memcpy(out_buffer, ticker, ticker_len);
out_buffer[ticker_len++] = ' ';
}

Expand Down

0 comments on commit 5b905fe

Please sign in to comment.