fuzz: change FuzzedSock::GetSockName() to always fully set the output

It would be somewhat broken OS if `getsockname()` returns `0` (success)
and returns `sa_family` as `AF_INET` and only sets e.g. 2 bytes in the
output.
This commit is contained in:
Vasil Dimov 2024-12-10 12:52:33 +01:00
parent 33d6a80c92
commit 72ff6d2b50
No known key found for this signature in database
GPG key ID: 54DF06F64B55CBBF

View file

@ -376,7 +376,9 @@ int FuzzedSock::GetSockName(sockaddr* name, socklen_t* name_len) const
SetFuzzedErrNo(m_fuzzed_data_provider, getsockname_errnos);
return -1;
}
*name_len = m_fuzzed_data_provider.ConsumeData(name, *name_len);
std::memcpy(name,
ConsumeFixedLengthByteVector(m_fuzzed_data_provider, *name_len).data(),
*name_len);
return 0;
}