fix: SponsoringAccountCount has no overflow protection #6898

This commit is contained in:
tequ
2026-04-21 17:20:22 +09:00
parent 7639bd9061
commit 773acf0af7

View File

@@ -437,6 +437,12 @@ Payment::doApply()
return tefINTERNAL; // LCOV_EXCL_LINE
auto const currentSponsoringAccountCount =
sponsor->getFieldU32(sfSponsoringAccountCount);
if (currentSponsoringAccountCount == std::numeric_limits<std::uint32_t>::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);