mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-13 03:09:37 +01:00
fuzz: never return an uninitialized sockaddr in FuzzedSock::GetSockName
The fuzz provider's `ConsumeData` may return less data than necessary to fill the sockaddr struct and still return success. Fix this to avoid the caller using uninitialized memory.
This commit is contained in:
parent
39b7e2b590
commit
0d472c1953
1 changed files with 2 additions and 0 deletions
|
@ -357,7 +357,9 @@ int FuzzedSock::GetSockName(sockaddr* name, socklen_t* name_len) const
|
|||
SetFuzzedErrNo(m_fuzzed_data_provider, getsockname_errnos);
|
||||
return -1;
|
||||
}
|
||||
assert(name_len);
|
||||
*name_len = m_fuzzed_data_provider.ConsumeData(name, *name_len);
|
||||
if (*name_len < (int)sizeof(sockaddr)) return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue