diff --git a/src/libxrpl/tx/transactors/payment/Payment.cpp b/src/libxrpl/tx/transactors/payment/Payment.cpp index 81f0b06dc2..163b7f6cac 100644 --- a/src/libxrpl/tx/transactors/payment/Payment.cpp +++ b/src/libxrpl/tx/transactors/payment/Payment.cpp @@ -437,6 +437,12 @@ Payment::doApply() return tefINTERNAL; // LCOV_EXCL_LINE auto const currentSponsoringAccountCount = sponsor->getFieldU32(sfSponsoringAccountCount); + if (currentSponsoringAccountCount == std::numeric_limits::max()) + { + JLOG(j_.fatal()) << "Sponsoring account count overflow for account " + << to_string(account_); + return tecINTERNAL; // LCOV_EXCL_LINE + } sponsor->setFieldU32(sfSponsoringAccountCount, currentSponsoringAccountCount + 1); addSponsorToLedgerEntry(sleDst, sponsor);