aboutsummaryrefslogtreecommitdiff
path: root/src/core_read.cpp
diff options
context:
space:
mode:
authorLuke Dashjr <luke-jr+git@utopios.org>2014-12-17 09:34:09 +0000
committerLuke Dashjr <luke-jr+git@utopios.org>2014-12-17 09:37:58 +0000
commit7f718139191d67da29c5d856d29e035bbc51e659 (patch)
treeafb10b02f54d3d94a2a20126d3108dc6d9744160 /src/core_read.cpp
parent41cced21063a89992ef393dda4fffc44ff60c7c3 (diff)
downloadbitcoin-7f718139191d67da29c5d856d29e035bbc51e659.tar.xz
Bugfix: prioritisetransaction: Do some basic sanity checking on txid
Besides giving a nicer error, this also prevents logging arbitrary data (which could have been used to exploit log readers) into debug.log
Diffstat (limited to 'src/core_read.cpp')
-rw-r--r--src/core_read.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/core_read.cpp b/src/core_read.cpp
index 65c3a08c55..beb746ce97 100644
--- a/src/core_read.cpp
+++ b/src/core_read.cpp
@@ -131,6 +131,11 @@ uint256 ParseHashUV(const UniValue& v, const string& strName)
string strHex;
if (v.isStr())
strHex = v.getValStr();
+ return ParseHashStr(strHex, strName); // Note: ParseHashStr("") throws a runtime_error
+}
+
+uint256 ParseHashStr(const std::string& strHex, const std::string& strName)
+{
if (!IsHex(strHex)) // Note: IsHex("") is false
throw runtime_error(strName+" must be hexadecimal string (not '"+strHex+"')");