mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-03 08:55:52 +00:00
Reject invalid MessageKey in SetAccount handler (RIPD-308, RIPD-990)
This commit is contained in:
committed by
Howard Hinnant
parent
2ae68923cc
commit
4d19b8be07
@@ -23,6 +23,7 @@
|
||||
#include <ripple/core/Config.h>
|
||||
#include <ripple/protocol/Feature.h>
|
||||
#include <ripple/protocol/Indexes.h>
|
||||
#include <ripple/protocol/PublicKey.h>
|
||||
#include <ripple/protocol/Quality.h>
|
||||
#include <ripple/protocol/st.h>
|
||||
#include <ripple/ledger/View.h>
|
||||
@@ -123,15 +124,17 @@ SetAccount::preflight (PreflightContext const& ctx)
|
||||
}
|
||||
}
|
||||
|
||||
auto const messageKey = tx[~sfMessageKey];
|
||||
if (messageKey && messageKey->size() > PUBLIC_BYTES_MAX)
|
||||
if (auto const mk = tx[~sfMessageKey])
|
||||
{
|
||||
JLOG(j.trace()) << "message key too long";
|
||||
return telBAD_PUBLIC_KEY;
|
||||
if (mk->size() && ! publicKeyType ({mk->data(), mk->size()}))
|
||||
{
|
||||
JLOG(j.trace()) << "Invalid message key specified.";
|
||||
return telBAD_PUBLIC_KEY;
|
||||
}
|
||||
}
|
||||
|
||||
auto const domain = tx[~sfDomain];
|
||||
if (domain&& domain->size() > DOMAIN_BYTES_MAX)
|
||||
if (domain && domain->size() > DOMAIN_BYTES_MAX)
|
||||
{
|
||||
JLOG(j.trace()) << "domain too long";
|
||||
return telBAD_DOMAIN;
|
||||
|
||||
@@ -33,7 +33,6 @@ class SetAccount
|
||||
: public Transactor
|
||||
{
|
||||
static std::size_t const DOMAIN_BYTES_MAX = 256;
|
||||
static std::size_t const PUBLIC_BYTES_MAX = 33;
|
||||
|
||||
public:
|
||||
SetAccount (ApplyContext& ctx)
|
||||
|
||||
Reference in New Issue
Block a user