Skip to content

Commit 5714b42

Browse files
JoelKatzMark Travis
authored andcommitted
Impose a local limit on path lengths
1 parent c4e9c49 commit 5714b42

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/ripple_app/transactors/Payment.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,14 @@ TER PaymentTransactor::doApply ()
212212
try
213213
{
214214
bool const openLedger = is_bit_set (mParams, tapOPEN_LEDGER);
215-
bool const tooManyPaths = spsPaths.size () > MaxPathSize;
216215

217-
terResult = openLedger && tooManyPaths
216+
bool pathTooBig = spsPaths.size () > MaxPathSize;
217+
218+
for (auto const& path : spsPaths)
219+
if (path.size () > MaxPathLength)
220+
pathTooBig = true;
221+
222+
terResult = openLedger && pathTooBig
218223
? telBAD_PATH_COUNT // Too many paths for proposed ledger.
219224
: RippleCalc::rippleCalc (
220225
mEngine->view (),

src/ripple_app/transactors/Payment.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ class PaymentTransactor
3737
/* The largest number of paths we allow */
3838
static std::size_t const MaxPathSize = 6;
3939

40+
/* The longest path we allow */
41+
static std::size_t const MaxPathLength = 8;
42+
4043
public:
4144
PaymentTransactor (
4245
SerializedTransaction const& txn,

0 commit comments

Comments
 (0)