mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-22 23:45:49 +01:00
Additionally initialize fd_set's via memset in mbedtls_net_poll
The initialization via FD_SET is not seen by memory sanitizers if FD_SET is implemented through assembly. Additionally zeroizing the respective fd_set's before calling FD_SET contents the sanitizers and comes at a negligible computational overhead.
This commit is contained in:
parent
2bd57578af
commit
f4e5b7e87d
@ -459,6 +459,12 @@ int mbedtls_net_poll( mbedtls_net_context *ctx, uint32_t rw, uint32_t timeout )
|
|||||||
if( fd < 0 )
|
if( fd < 0 )
|
||||||
return( MBEDTLS_ERR_NET_INVALID_CONTEXT );
|
return( MBEDTLS_ERR_NET_INVALID_CONTEXT );
|
||||||
|
|
||||||
|
/* Ensure that memory sanitizers consider
|
||||||
|
* read_fds and write_fds as initialized even
|
||||||
|
* if FD_ZERO is implemented in assembly. */
|
||||||
|
memset( &read_fds, 0, sizeof( read_fds ) );
|
||||||
|
memset( &write_fds, 0, sizeof( write_fds ) );
|
||||||
|
|
||||||
FD_ZERO( &read_fds );
|
FD_ZERO( &read_fds );
|
||||||
if( rw & MBEDTLS_NET_POLL_READ )
|
if( rw & MBEDTLS_NET_POLL_READ )
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user