Skip to content

release: fold the Maya memo fix into develop - #494

Merged
BitHighlander merged 2 commits into
developfrom
release/7.14.2
Aug 20, 2026
Merged

release: fold the Maya memo fix into develop#494
BitHighlander merged 2 commits into
developfrom
release/7.14.2

Conversation

@BitHighlander

Copy link
Copy Markdown
Owner

Completes the 7.14.2 line on develop. #418 merged before the Maya fixes landed on the release branch, so develop is missing them.

Contents: the strict NUL rule for THORChain plus the same memo fixes Maya never received (strlcpy truncation, sizeof->strnlen, %s->confirm_bytes), corrected fixture length words, and the pyk repin.

7.15 stages on top of this.

BitHighlander and others added 2 commits August 20, 2026 17:10
… chains

THORChain and Maya both copy a byte-counted memo into a buffer and then parse it
with strtok, which stops at the first NUL. Every byte inside the declared length
is signed, so a memo like "=:ETH.ETH:<dest>:0\0:affiliate:75" confirmed as if it
ended at the zero byte while the affiliate suffix stayed in the calldata.

Both now refuse any NUL inside the declared length. A length word that does not
describe its own content is a non-canonical encoding -- the same thing the ABI
offset-word validation already rejects -- and there is no honest way to parse it.
The caller's unparsed path discloses the raw bytes with a length-aware writer.

Maya had more than that. It is a fork of the THORChain code and never received
the earlier fixes, so it still had:

  strlcpy(memoBuf, swapStr, size)   dropped the memo's last character; an
                                    affiliate fee of "75" bps rendered as "7"
  sizeof(memo) at both callers      handed the parser a fixed array's trailing
                                    zeros as if they were content
  confirm(..., "%s", memo)          the unparsed fallback truncated at the same
                                    NUL, which would have moved the defect one
                                    screen later rather than removing it

Found by auditing every confirm body fed a protobuf bytes field through "%s",
which is what #465 asks for. Reading the THORChain patch would not have found
it; only looking at every caller did.

Two add_liquidity fixtures declared 59 bytes for a 58-byte memo and now fail
against the stricter rule. They were wrong: the 59th byte is ABI padding. Fixed
in python-keepkey with signatures repinned, and repinned here.

Unit tests cover an interior NUL, a trailing NUL, and the same memo with a
truthful length -- the last is the control proving the rule rejects the
declaration rather than the memo.
fix(memo): refuse a length that misdescribes its own content, in both chains
@BitHighlander
BitHighlander merged commit bd3a1d6 into develop Aug 20, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant