Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/i2p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ std::string Session::Reply::Get(const std::string& key) const
const auto& pos = keys.find(key);
if (pos == keys.end() || !pos->second.has_value()) {
throw std::runtime_error(
strprintf("Missing %s= in the reply to \"%s\": \"%s\"", key, request, full));
strprintf("Missing %s= in the reply to \"%s\"", key, request));
}
return pos->second.value();
}
Expand Down Expand Up @@ -320,7 +320,7 @@ Session::Reply Session::SendRequestAndGetReply(const Sock& sock,

if (check_result_ok && reply.Get("RESULT") != "OK") {
throw std::runtime_error(
strprintf("Unexpected reply to \"%s\": \"%s\"", request, reply.full));
strprintf("Reply to \"%s\": had a RESULT not equal to OK.", reply.request));
}

return reply;
Expand Down
21 changes: 17 additions & 4 deletions src/test/fuzz/connman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,14 @@ FUZZ_TARGET(connman, .init = initialize_connman)
CNode random_node = ConsumeNode(fuzzed_data_provider);
CSubNet random_subnet;
std::string random_string;
std::vector<NodeId> node_ids;

LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 100) {
CNode& p2p_node{*ConsumeNodeAsUniquePtr(fuzzed_data_provider).release()};
// Simulate post-handshake state.
p2p_node.fSuccessfullyConnected = true;
connman.AddTestNode(p2p_node);
node_ids.push_back(p2p_node.GetId());
}

LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 10000) {
Expand Down Expand Up @@ -141,10 +143,15 @@ FUZZ_TARGET(connman, .init = initialize_connman)
connman.DisconnectNode(random_subnet);
},
[&] {
connman.ForEachNode([](auto) {});
},
[&] {
(void)connman.ForNode(fuzzed_data_provider.ConsumeIntegral<NodeId>(), [&](auto) { return fuzzed_data_provider.ConsumeBool(); });
NodeId id = node_ids.empty() || fuzzed_data_provider.ConsumeBool()
? fuzzed_data_provider.ConsumeIntegral<NodeId>()
: PickValue(fuzzed_data_provider, node_ids);
(void)connman.ForNode(id, [&](CNode* pnode) {
(void)pnode->GetId();
(void)pnode->IsInboundConn();
(void)pnode->IsFullOutboundConn();
return true;
});
},
[&] {
auto max_addresses = fuzzed_data_provider.ConsumeIntegral<size_t>();
Expand Down Expand Up @@ -228,6 +235,12 @@ FUZZ_TARGET(connman, .init = initialize_connman)
connman.SocketHandlerPublic();
});
}
connman.ForEachNode([](CNode* pnode) {
(void)pnode->GetId();
(void)pnode->IsInboundConn();
(void)pnode->IsFullOutboundConn();
(void)pnode->ConnectionTypeAsString();
});
(void)connman.GetAddedNodeInfo(fuzzed_data_provider.ConsumeBool());
(void)connman.GetExtraFullOutboundCount();
(void)connman.GetLocalServices();
Expand Down
Loading