aboutsummaryrefslogtreecommitdiff
path: root/src/univalue
diff options
context:
space:
mode:
authorMacroFake <falke.marco@gmail.com>2022-06-23 21:48:43 +0200
committerMacroFake <falke.marco@gmail.com>2022-06-24 08:45:44 +0200
commitfa8a1c06961f4b1826696e0db8dce81dce627721 (patch)
tree566447922cd4c57048a4e6957b0b7daef23f317f /src/univalue
parentf697c068ebd0dfea552c1ff192dfd9d520f1ca9a (diff)
downloadbitcoin-fa8a1c06961f4b1826696e0db8dce81dce627721.tar.xz
rpc: Fix Univalue push_backV OOM in listtransactions
Diffstat (limited to 'src/univalue')
-rw-r--r--src/univalue/include/univalue.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/univalue/include/univalue.h b/src/univalue/include/univalue.h
index 22be0311e8..7f9a6aaffd 100644
--- a/src/univalue/include/univalue.h
+++ b/src/univalue/include/univalue.h
@@ -84,6 +84,8 @@ public:
bool push_back(const UniValue& val);
bool push_backV(const std::vector<UniValue>& vec);
+ template <class It>
+ bool push_backV(It first, It last);
void __pushKV(const std::string& key, const UniValue& val);
bool pushKV(const std::string& key, const UniValue& val);
@@ -137,6 +139,14 @@ public:
friend const UniValue& find_value( const UniValue& obj, const std::string& name);
};
+template <class It>
+bool UniValue::push_backV(It first, It last)
+{
+ if (typ != VARR) return false;
+ values.insert(values.end(), first, last);
+ return true;
+}
+
enum jtokentype {
JTOK_ERR = -1,
JTOK_NONE = 0, // eof