mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-27 14:35:52 +00:00
Disallow invalid flags on OfferCreate transactions.
This commit is contained in:
@@ -244,8 +244,8 @@ TER OfferCreateTransactor::takeOffers(
|
|||||||
TER OfferCreateTransactor::doApply()
|
TER OfferCreateTransactor::doApply()
|
||||||
{
|
{
|
||||||
Log(lsWARNING) << "doOfferCreate> " << mTxn.getJson(0);
|
Log(lsWARNING) << "doOfferCreate> " << mTxn.getJson(0);
|
||||||
const uint32 txFlags = mTxn.getFlags();
|
const uint32 uTxFlags = mTxn.getFlags();
|
||||||
const bool bPassive = isSetBit(txFlags, tfPassive);
|
const bool bPassive = isSetBit(uTxFlags, tfPassive);
|
||||||
STAmount saTakerPays = mTxn.getFieldAmount(sfTakerPays);
|
STAmount saTakerPays = mTxn.getFieldAmount(sfTakerPays);
|
||||||
STAmount saTakerGets = mTxn.getFieldAmount(sfTakerGets);
|
STAmount saTakerGets = mTxn.getFieldAmount(sfTakerGets);
|
||||||
|
|
||||||
@@ -273,7 +273,13 @@ TER OfferCreateTransactor::doApply()
|
|||||||
uint64 uOwnerNode;
|
uint64 uOwnerNode;
|
||||||
uint64 uBookNode;
|
uint64 uBookNode;
|
||||||
|
|
||||||
if (bHaveExpiration && !uExpiration)
|
if (uTxFlags & tfOfferCreateMask)
|
||||||
|
{
|
||||||
|
Log(lsINFO) << "doOfferCreate: Malformed transaction: Invalid flags set.";
|
||||||
|
|
||||||
|
return temINVALID_FLAG;
|
||||||
|
}
|
||||||
|
else if (bHaveExpiration && !uExpiration)
|
||||||
{
|
{
|
||||||
Log(lsWARNING) << "doOfferCreate: Malformed offer: bad expiration";
|
Log(lsWARNING) << "doOfferCreate: Malformed offer: bad expiration";
|
||||||
|
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ const int TransactionMaxLen = 1048576;
|
|||||||
|
|
||||||
// OfferCreate flags:
|
// OfferCreate flags:
|
||||||
const uint32 tfPassive = 0x00010000;
|
const uint32 tfPassive = 0x00010000;
|
||||||
|
const uint32 tfOfferCreateMask = ~(tfPassive);
|
||||||
|
|
||||||
// Payment flags:
|
// Payment flags:
|
||||||
const uint32 tfCreateAccount = 0x00010000;
|
const uint32 tfCreateAccount = 0x00010000;
|
||||||
|
|||||||
Reference in New Issue
Block a user