aboutsummaryrefslogtreecommitdiff
path: root/src/test/fuzz/util/net.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/fuzz/util/net.cpp')
-rw-r--r--src/test/fuzz/util/net.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/test/fuzz/util/net.cpp b/src/test/fuzz/util/net.cpp
index d23e997719..5a286c05d2 100644
--- a/src/test/fuzz/util/net.cpp
+++ b/src/test/fuzz/util/net.cpp
@@ -36,7 +36,11 @@ CNetAddr ConsumeNetAddr(FuzzedDataProvider& fuzzed_data_provider) noexcept
} else if (network == Network::NET_IPV6) {
if (fuzzed_data_provider.remaining_bytes() >= 16) {
in6_addr v6_addr = {};
- memcpy(v6_addr.s6_addr, fuzzed_data_provider.ConsumeBytes<uint8_t>(16).data(), 16);
+ auto addr_bytes = fuzzed_data_provider.ConsumeBytes<uint8_t>(16);
+ if (addr_bytes[0] == CJDNS_PREFIX) { // Avoid generating IPv6 addresses that look like CJDNS.
+ addr_bytes[0] = 0x55; // Just an arbitrary number, anything != CJDNS_PREFIX would do.
+ }
+ memcpy(v6_addr.s6_addr, addr_bytes.data(), 16);
net_addr = CNetAddr{v6_addr, fuzzed_data_provider.ConsumeIntegral<uint32_t>()};
}
} else if (network == Network::NET_INTERNAL) {