Skip to content

Commit fa9c455

Browse files
author
MarcoFalke
committed
cli: Reject + sign in -netinfo level parsing
It would be confusing to specify the sign for an unsigned value here, so reject it.
1 parent fa98041 commit fa9c455

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/bitcoin-cli.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright (c) 2009-2010 Satoshi Nakamoto
2-
// Copyright (c) 2009-2022 The Bitcoin Core developers
2+
// Copyright (c) 2009-present The Bitcoin Core developers
33
// Distributed under the MIT software license, see the accompanying
44
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
55

@@ -472,7 +472,8 @@ class NetinfoRequestHandler : public BaseRequestHandler
472472
{
473473
if (!args.empty()) {
474474
uint8_t n{0};
475-
if (ParseUInt8(args.at(0), &n)) {
475+
if (const auto res{ToIntegral<uint8_t>(args.at(0))}) {
476+
n = *res;
476477
m_details_level = std::min(n, NETINFO_MAX_LEVEL);
477478
} else {
478479
throw std::runtime_error(strprintf("invalid -netinfo level argument: %s\nFor more information, run: bitcoin-cli -netinfo help", args.at(0)));

0 commit comments

Comments
 (0)