From 11781458e176e093852ee7241dde2e2aba033f18 Mon Sep 17 00:00:00 2001 From: Thomas de Zeeuw Date: Sat, 30 Dec 2023 20:41:15 +0100 Subject: [PATCH] Fix size of tuple SocketAddress implementations size_of::() for these implementations includes the address length, but we don't want to use that, only the storage part of the address. --- src/net.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/net.rs b/src/net.rs index e25589d..dc67579 100644 --- a/src/net.rs +++ b/src/net.rs @@ -1069,7 +1069,7 @@ impl SocketAddress for (libc::sockaddr, libc::socklen_t) { unsafe fn as_mut_ptr(this: &mut MaybeUninit) -> (*mut libc::sockaddr, libc::socklen_t) { ( ptr::addr_of_mut!((*this.as_mut_ptr()).0).cast(), - size_of::() as _, + size_of::() as _, ) } @@ -1091,7 +1091,7 @@ impl SocketAddress for (libc::sockaddr_storage, libc::socklen_t) { unsafe fn as_mut_ptr(this: &mut MaybeUninit) -> (*mut libc::sockaddr, libc::socklen_t) { ( ptr::addr_of_mut!((*this.as_mut_ptr()).0).cast(), - size_of::() as _, + size_of::() as _, ) } @@ -1153,7 +1153,7 @@ impl SocketAddress for (libc::sockaddr_un, libc::socklen_t) { unsafe fn as_mut_ptr(this: &mut MaybeUninit) -> (*mut libc::sockaddr, libc::socklen_t) { ( ptr::addr_of_mut!((*this.as_mut_ptr()).0).cast(), - size_of::() as _, + size_of::() as _, ) }