mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-03 08:46:46 +00:00
fix
This commit is contained in:
@@ -19,6 +19,14 @@ namespace xrpl::permissioned_dex {
|
||||
bool
|
||||
accountInDomain(ReadView const& view, AccountID const& account, Domain const& domainID)
|
||||
{
|
||||
// A zero domainID is malformed: it would build a keylet with a zero key
|
||||
// and violate Ledger::read's invariant. Defense in depth: callers should
|
||||
// reject this at preflight, but guard here too so any future caller and
|
||||
// the order-book sweep path (offerInDomain -> here) cannot trip the
|
||||
// invariant.
|
||||
if (domainID.isZero())
|
||||
return false;
|
||||
|
||||
auto const sleDomain = view.read(keylet::permissionedDomain(domainID));
|
||||
if (!sleDomain)
|
||||
return false;
|
||||
|
||||
@@ -94,6 +94,16 @@ OfferCreate::preflight(PreflightContext const& ctx)
|
||||
if (tx.isFlag(tfHybrid) && !tx.isFieldPresent(sfDomainID))
|
||||
return temINVALID_FLAG;
|
||||
|
||||
// A present but zero DomainID is malformed: it would build a keylet with
|
||||
// a zero key and violate Ledger::read's invariant. Reject at preflight
|
||||
// (temMALFORMED) instead of letting it slip to preclaim and be
|
||||
// misclassified as tecNO_PERMISSION.
|
||||
if (tx.isFieldPresent(sfDomainID) && tx.getFieldH256(sfDomainID).isZero())
|
||||
{
|
||||
JLOG(j.debug()) << "Malformed offer: zero DomainID";
|
||||
return temMALFORMED;
|
||||
}
|
||||
|
||||
bool const bImmediateOrCancel(tx.isFlag(tfImmediateOrCancel));
|
||||
bool const bFillOrKill(tx.isFlag(tfFillOrKill));
|
||||
|
||||
|
||||
@@ -125,6 +125,16 @@ Payment::preflight(PreflightContext const& ctx)
|
||||
if (!mpTokensV2 && isDstMPT && ctx.tx.isFieldPresent(sfPaths))
|
||||
return temMALFORMED;
|
||||
|
||||
// A present but zero DomainID is malformed: it would build a keylet with
|
||||
// a zero key and violate Ledger::read's invariant. Reject at preflight
|
||||
// (temMALFORMED) instead of letting it slip to preclaim and be
|
||||
// misclassified as tecNO_PERMISSION.
|
||||
if (tx.isFieldPresent(sfDomainID) && tx.getFieldH256(sfDomainID).isZero())
|
||||
{
|
||||
JLOG(j.debug()) << "Malformed payment: zero DomainID";
|
||||
return temMALFORMED;
|
||||
}
|
||||
|
||||
bool const partialPaymentAllowed = tx.isFlag(tfPartialPayment);
|
||||
bool const limitQuality = tx.isFlag(tfLimitQuality);
|
||||
bool const defaultPathsAllowed = !tx.isFlag(tfNoRippleDirect);
|
||||
|
||||
Reference in New Issue
Block a user