LedgerHQ/app-ethereum

Fix external plugin last parameter not sanitized when the last parameter is not full length.

Benjyskan opened this issue · 0 comments

Description

In plugin's context, if the last parameter received is not full size, the buffer keep data from previous parameter.
the parsed tx is https://polygonscan.com/tx/0x7eeaf429adfb462f8f12b5a7f21e3523b92f68bec674b6c72330ee2fbb3f2962

This is the second last parameter:
000000000000000000000000000000000000000000000000000000000003A5D6

This is the last parameter:
000000000000000000000000000000020000000000000000000000000003A5D6

but last parameter should be:
0000000000000000000000000000000200000000000000000000000000000000
the 3A5D6 bytes from the previous parameter should not be included in the last parameter.

Your environment

  • app-ethereum branch develop
  • Device Nano S, Nano X, Nano SP

Steps to reproduce

https://github.com/NestedFi/nested-ledger-plugin on update branch and run simple deposit test.

Expected behaviour

Last parameter should be:
0000000000000000000000000000000200000000000000000000000000000000
but it's:
000000000000000000000000000000020000000000000000000000000003A5D6

Proposed solution

Sanitize the parameter buffer (dataContext.tokenContext.data) between each plugin's call. I'll link an untested PR that fix the issue.