From 6c2d60cec24c6e0d539b440e59d376c2bbb170e6 Mon Sep 17 00:00:00 2001 From: Tom Ritchford Date: Tue, 13 Jan 2015 10:47:35 -0500 Subject: [PATCH] Prevent RPC handlers from returning non-objects. --- src/ripple/rpc/impl/Handler.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/ripple/rpc/impl/Handler.cpp b/src/ripple/rpc/impl/Handler.cpp index 535757c51..58f2fae8d 100644 --- a/src/ripple/rpc/impl/Handler.cpp +++ b/src/ripple/rpc/impl/Handler.cpp @@ -32,6 +32,12 @@ Handler::Method byRef (Function const& f) return [f] (Context& context, Json::Value& result) { result = f (context); + if (result.type() != Json::objectValue) + { + assert (false); + result = RPC::makeObjectValue (result); + } + return Status(); }; }