bounds checks and such

pull/1272/head
Jeff Becker 4 years ago
parent a45f92dca7
commit 3a776b3ed1
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -272,7 +272,7 @@ namespace llarp
m_upstreamDNS.push_back(parseDNSAddr(std::move(arg)));
});
conf.defineOption<std::string>("dns", "bind", false, std::nullopt, [=](std::string arg) {
conf.defineOption<std::string>("dns", "bind", false, "127.3.2.1:53", [=](std::string arg) {
m_bind = parseDNSAddr(std::move(arg));
});
}

@ -53,7 +53,7 @@ namespace llarp
operator()(const TXOwner& o) const noexcept
{
std::size_t sz2;
memcpy(&sz2, &o.node[0], sizeof(std::size_t));
memcpy(&sz2, o.node.data(), sizeof(std::size_t));
return o.txid ^ (sz2 << 1);
}
};

@ -753,6 +753,7 @@ namespace llarp
{
return;
}
if (not itr->second.Verify())
{
LogError("bad short xmit hash from ", m_RemoteAddr);

@ -80,13 +80,13 @@ namespace llarp
}
std::vector<std::string_view>
split(std::string_view str, char delimiter)
split(const std::string_view str, char delimiter)
{
std::vector<std::string_view> splits;
const auto str_size = str.size();
size_t last = 0;
size_t next = 0;
while (last < str.size() and next < std::string_view::npos)
while (last < str_size and next < std::string_view::npos)
{
next = str.find_first_of(delimiter, last);
if (next > last)
@ -96,7 +96,7 @@ namespace llarp
last = next;
// advance to next non-delimiter
while (str[last] == delimiter)
while (str[last] == delimiter and last < str_size)
last++;
}
else

@ -42,7 +42,7 @@ namespace llarp
/// @param delimiter is the character to split on
/// @return a vector of std::string_views with the split words, excluding the delimeter
std::vector<std::string_view>
split(std::string_view str, char delimiter);
split(const std::string_view str, char delimiter);
} // namespace llarp

Loading…
Cancel
Save