diff --git a/src/test/fuzz/util/net.cpp b/src/test/fuzz/util/net.cpp index 5e7aae670ee..562fa4ce683 100644 --- a/src/test/fuzz/util/net.cpp +++ b/src/test/fuzz/util/net.cpp @@ -191,11 +191,11 @@ ssize_t FuzzedSock::Recv(void* buf, size_t len, int flags) const } std::vector random_bytes; bool pad_to_len_bytes{m_fuzzed_data_provider.ConsumeBool()}; - if (m_peek_data.has_value()) { + if (!m_peek_data.empty()) { // `MSG_PEEK` was used in the preceding `Recv()` call, return `m_peek_data`. - random_bytes = m_peek_data.value(); + random_bytes = m_peek_data; if ((flags & MSG_PEEK) == 0) { - m_peek_data.reset(); + m_peek_data.clear(); } pad_to_len_bytes = false; } else if ((flags & MSG_PEEK) != 0) { diff --git a/src/test/fuzz/util/net.h b/src/test/fuzz/util/net.h index ed026806763..1a5902329e2 100644 --- a/src/test/fuzz/util/net.h +++ b/src/test/fuzz/util/net.h @@ -43,7 +43,7 @@ class FuzzedSock : public Sock * If `MSG_PEEK` is used, then our `Recv()` returns some random data as usual, but on the next * `Recv()` call we must return the same data, thus we remember it here. */ - mutable std::optional> m_peek_data; + mutable std::vector m_peek_data; /** * Whether to pretend that the socket is select(2)-able. This is randomly set in the