You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Current behavior:
When creating a QX asset via qubic-cli (-qxissueasset) with a name with more than 7 characters or in lower case or with an already existing asset name, the QX issuance fee is paid but the asset is not issued.
Desired new behavior:
for more than 7 chars or lower case: implement a check in qubic-cli that returns a warning to the user (without trying to issue the asset, hence not paying any fee)
existing asset name: explicitly mention in help that it needs to be a new/unique asset name. Because every issuer has their own asset namespace we can assume the user knows which asset names they created before.
Worth flagging a memory-safety angle on this: the missing asset-name length check
isn't only a wasted-fee UX problem — a name longer than the buffer currently overflows it.
Across qx.cpp, qswap.cpp and nostromo.cpp there are ~19 copies of the form
char assetNameS1[8] = {0};
memcpy(assetNameS1, assetName, strlen(assetName)); // no bound
(and the assetNameU1[8] / &input.assetName / &v.asset.assetName variants).
The destination is 8 bytes, but strlen(assetName) is unbounded, so a name
longer than 8 chars writes past it. Confirmed with AddressSanitizer: stack-buffer-overflow, WRITE of size 11 for an 11-char name.
Notably the safe pattern already exists in the codebase — asset_utils.cpp:307 does memcpy(&packet.req.byFilter.assetName, value.c_str(), std::min(size_t(7), value.length())).
So there are two complementary fixes:
The validation this issue asks for — reject a name > 7 chars (or not
uppercase) up front, with a warning, before any fee is paid.
Independently, bound those ~19 memcpy copies to the field size (as asset_utils.cpp already does), so a bad name can never corrupt memory even
if it slips past validation.
Opened #137 for (2) — the mechanical bounding of all 19 asset-name copies across qx.cpp, qswap.cpp and nostromo.cpp, routed through a copyAssetNameBounded() helper and ASAN-verified (the old pattern overflows with an 11-char name; the bounded version is clean). The up-front name validation this issue asks for is complementary. (The node-IP and proposal-URL copies were the same class of bug — those are in #134.)
Opened #137 for the memory-safety half (fix (2) from above): all 19 unbounded asset-name copies across qx.cpp, qswap.cpp and nostromo.cpp now route through a small copyAssetNameBounded() helper in asset_utils.h that caps the copy at the field size, mirroring the bounded copy asset_utils.cpp already uses. ASAN-verified: the old pattern overflows (WRITE of size 11 on an 8-byte buffer), the bounded version is clean. The up-front name validation this issue originally asks for is complementary and can go in alongside it.
Activity
philippwerner commentedon Jan 29, 2025
Partially addressed in PR #64
parthod0x commentedon Oct 7, 2026
Worth flagging a memory-safety angle on this: the missing asset-name length check
isn't only a wasted-fee UX problem — a name longer than the buffer currently
overflows it.
Across
qx.cpp,qswap.cppandnostromo.cppthere are ~19 copies of the form(and the
assetNameU1[8]/&input.assetName/&v.asset.assetNamevariants).The destination is 8 bytes, but
strlen(assetName)is unbounded, so a namelonger than 8 chars writes past it. Confirmed with AddressSanitizer:
stack-buffer-overflow, WRITE of size 11for an 11-char name.Notably the safe pattern already exists in the codebase —
asset_utils.cpp:307doesmemcpy(&packet.req.byFilter.assetName, value.c_str(), std::min(size_t(7), value.length())).So there are two complementary fixes:
uppercase) up front, with a warning, before any fee is paid.
memcpycopies to the field size (asasset_utils.cppalready does), so a bad name can never corrupt memory evenif it slips past validation.
Opened #137 for (2) — the mechanical bounding of all 19 asset-name copies across
qx.cpp,qswap.cppandnostromo.cpp, routed through acopyAssetNameBounded()helper and ASAN-verified (the old pattern overflows with an 11-char name; the bounded version is clean). The up-front name validation this issue asks for is complementary. (The node-IP and proposal-URL copies were the same class of bug — those are in #134.)parthod0x commentedon Oct 8, 2026
Opened #137 for the memory-safety half (fix (2) from above): all 19 unbounded asset-name copies across
qx.cpp,qswap.cppandnostromo.cppnow route through a smallcopyAssetNameBounded()helper inasset_utils.hthat caps the copy at the field size, mirroring the bounded copyasset_utils.cppalready uses. ASAN-verified: the old pattern overflows (WRITE of size 11 on an 8-byte buffer), the bounded version is clean. The up-front name validation this issue originally asks for is complementary and can go in alongside it.nostromo: validate asset name for transfer-rights and check-creatability
nostromo: validate asset name for transfer-rights and check-creatabil…