From 526b4a4a6d4e3374412e8a39eaea12ac948bf482 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Sun, 31 Mar 2013 23:55:59 -0700 Subject: [PATCH] Don't permit XRP to be specified as an object. --- src/cpp/ripple/Amount.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/cpp/ripple/Amount.cpp b/src/cpp/ripple/Amount.cpp index 115fd9a36..df38bbee7 100644 --- a/src/cpp/ripple/Amount.cpp +++ b/src/cpp/ripple/Amount.cpp @@ -158,7 +158,13 @@ STAmount::STAmount(SField::ref n, const Json::Value& v) mIsNative = !currency.isString() || currency.asString().empty() || (currency.asString() == SYSTEM_CURRENCY_CODE); - if (!mIsNative) { + if (mIsNative) + { + if (v.isObject()) + throw std::runtime_error("XRP may not be specified as an object"); + } + else + { // non-XRP if (!currencyFromString(mCurrency, currency.asString())) throw std::runtime_error("invalid currency");