Repository navigation
Bound asset-name copies to the field size (fixes stack overflow; addresses #58) - #137
Merged
Merged
Conversation
fnordspace
reviewed
Oct 15, 2026
fnordspace
left a comment
Contributor
There was a problem hiding this comment.
I think instead of adding a new function it is enough to check the input with `sanityCheckValidAssetName``` for the two missing SC:
case NOSTROMO_TRANSFER_SHARE_MANAGEMENT_RIGHTS:
sanityCheckNode(g_nodeIp, g_nodePort);
sanityCheckSeed(g_seed);
sanityCheckValidAssetName(g_nost_tokenName);
...
case NOSTROMO_CHECK_TOKEN_CREATABILITY:
sanityCheckNode(g_nodeIp, g_nodePort);
sanityCheckValidAssetName(g_nost_tokenName);
...
Two NOSTROMO subcommands dispatched g_nost_tokenName without first calling sanityCheckValidAssetName, so an over-long name reached the request builder and overran its 8-byte asset-name field. Every other asset command already validates the name up front; add the same check to these two (addresses qubic#58).
parthod0x
force-pushed
the
fix/asset-name-copy-overflow
branch
from
October 15, 2026 18:18
2d0b8f9 to
e1aca1c
Compare
Contributor
Author
|
Reworked per your suggestion: removed the helper and all the copy-site edits, and just added |
fnordspace
approved these changes
Oct 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses the memory-safety half of #58.
Problem
qx.cpp,qswap.cppandnostromo.cppcopy a user-supplied asset name into an 8-byte field with no bound — 19 sites of the form:(plus the
assetNameU1[8],&v.asset.assetNameand&input.assetNamevariants). A name longer than the field overflows it. AddressSanitizer on an 11-char name:Fix
Add a small
copyAssetNameBounded()helper inasset_utils.hthat caps the copy at the field size (asset names are at most 7 chars), mirroring the bounded copyasset_utils.cppalready uses:All 19 sites now route through it, so an over-long name can no longer corrupt memory even if it slips past input validation.
Verification (AddressSanitizer)
Driving the real helper from
asset_utils.h: the original unbounded pattern reportsstack-buffer-overflow, WRITE of size 11on an 8-byte buffer with an 11-char name;copyAssetNameBoundedbounds the copy to 7 and is clean.This is the defense-in-depth complement to the up-front validation #58 asks for (reject names > 7 chars before any fee is paid), and the same bug class as the node-IP / proposal-URL copies in #134.