aboutsummaryrefslogtreecommitdiff
path: root/src/core_write.cpp
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2022-02-11 17:26:40 +0100
committerMarcoFalke <falke.marco@gmail.com>2022-02-11 17:21:44 +0100
commitfa6065661a86656a29e89ed1a3529cb7103f5394 (patch)
tree2e45c008ce1bc6a519aa29f9e3417afed052cea0 /src/core_write.cpp
parentb79c40b057ec39045d0036d978b3c01a5cf9f712 (diff)
refactor: Avoid unsigned integer overflow in core_write
Diffstat (limited to 'src/core_write.cpp')
-rw-r--r--src/core_write.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/core_write.cpp b/src/core_write.cpp
index 5ea62cf3ed..c4b6b8d27e 100644
--- a/src/core_write.cpp
+++ b/src/core_write.cpp
@@ -65,7 +65,7 @@ std::string FormatScript(const CScript& script)
ret += strprintf("0x%x ", HexStr(std::vector<uint8_t>(it2, script.end())));
break;
}
- return ret.substr(0, ret.size() - 1);
+ return ret.substr(0, ret.empty() ? ret.npos : ret.size() - 1);
}
const std::map<unsigned char, std::string> mapSigHashTypes = {