diff --git a/src/ripple/module/app/transactors/Payment.cpp b/src/ripple/module/app/transactors/Payment.cpp index 21809d88b9..aeabcdec25 100644 --- a/src/ripple/module/app/transactors/Payment.cpp +++ b/src/ripple/module/app/transactors/Payment.cpp @@ -240,9 +240,14 @@ TER Payment::doApply () try { bool const openLedger = (mParams & tapOPEN_LEDGER); - bool const tooManyPaths = spsPaths.size () > MaxPathSize; - terResult = openLedger && tooManyPaths + bool pathTooBig = spsPaths.size () > MaxPathSize; + + for (auto const& path : spsPaths) + if (path.size () > MaxPathLength) + pathTooBig = true; + + terResult = openLedger && pathTooBig ? telBAD_PATH_COUNT // Too many paths for proposed ledger. : path::rippleCalculate ( mEngine->view (), diff --git a/src/ripple/module/app/transactors/Payment.h b/src/ripple/module/app/transactors/Payment.h index 9649caf496..064273226d 100644 --- a/src/ripple/module/app/transactors/Payment.h +++ b/src/ripple/module/app/transactors/Payment.h @@ -28,6 +28,9 @@ class Payment /* The largest number of paths we allow */ static std::size_t const MaxPathSize = 6; + /* The longest path we allow */ + static std::size_t const MaxPathLength = 8; + public: Payment ( SerializedTransaction const& txn,