mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
merge bitcoin#23538: Remove strtol in torcontrol
This commit is contained in:
parent
2318d9f996
commit
1f4e8a0cf9
@ -21,16 +21,13 @@
|
||||
#include <deque>
|
||||
#include <functional>
|
||||
#include <set>
|
||||
#include <stdlib.h>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/signals2/signal.hpp>
|
||||
|
||||
#include <event2/bufferevent.h>
|
||||
#include <event2/buffer.h>
|
||||
#include <event2/util.h>
|
||||
#include <event2/bufferevent.h>
|
||||
#include <event2/event.h>
|
||||
#include <event2/thread.h>
|
||||
#include <event2/util.h>
|
||||
|
||||
/** Default control port */
|
||||
const std::string DEFAULT_TOR_CONTROL = "127.0.0.1:9051";
|
||||
@ -273,9 +270,15 @@ std::map<std::string,std::string> ParseTorReplyMapping(const std::string &s)
|
||||
if (j == 3 && value[i] > '3') {
|
||||
j--;
|
||||
}
|
||||
escaped_value.push_back(strtol(value.substr(i, j).c_str(), nullptr, 8));
|
||||
const auto end{i + j};
|
||||
uint8_t val{0};
|
||||
while (i < end) {
|
||||
val *= 8;
|
||||
val += value[i++] - '0';
|
||||
}
|
||||
escaped_value.push_back(char(val));
|
||||
// Account for automatic incrementing at loop end
|
||||
i += j - 1;
|
||||
--i;
|
||||
} else {
|
||||
escaped_value.push_back(value[i]);
|
||||
}
|
||||
|
@ -47,7 +47,6 @@ KNOWN_VIOLATIONS=(
|
||||
"src/test/dbwrapper_tests.cpp:.*snprintf"
|
||||
"src/test/fuzz/locale.cpp"
|
||||
"src/test/fuzz/string.cpp"
|
||||
"src/torcontrol.cpp:.*strtol"
|
||||
"src/util/strencodings.cpp:.*strtoll"
|
||||
"src/util/system.cpp:.*fprintf"
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user