]> git.lizzy.rs Git - rust.git/commitdiff
addrinfo hint in lookup_host() needs clean initialization on all platforms
authorDanek Duvall <danek.duvall@oracle.com>
Mon, 7 Aug 2017 03:12:53 +0000 (20:12 -0700)
committerDanek Duvall <danek.duvall@oracle.com>
Mon, 7 Aug 2017 16:07:26 +0000 (09:07 -0700)
Fixes #43649

src/liblibc
src/libstd/sys_common/net.rs

index ec1e5ab1ef8baca57f8776bbebd9343572a87082..2a5b50b7f7f539a0fd201331d6c1e0534aa332f5 160000 (submodule)
@@ -1 +1 @@
-Subproject commit ec1e5ab1ef8baca57f8776bbebd9343572a87082
+Subproject commit 2a5b50b7f7f539a0fd201331d6c1e0534aa332f5
index 5775dd4f1fcd44b89e170e5ce6e11b55d61f7dc1..1ca39ff9d4a1ce296117d6357987550c38e39d37 100644 (file)
@@ -165,16 +165,8 @@ pub fn lookup_host(host: &str) -> io::Result<LookupHost> {
     init();
 
     let c_host = CString::new(host)?;
-    let hints = c::addrinfo {
-        ai_flags: 0,
-        ai_family: 0,
-        ai_socktype: c::SOCK_STREAM,
-        ai_protocol: 0,
-        ai_addrlen: 0,
-        ai_addr: ptr::null_mut(),
-        ai_canonname: ptr::null_mut(),
-        ai_next: ptr::null_mut()
-    };
+    let mut hints: c::addrinfo = unsafe { mem::zeroed() };
+    hints.ai_socktype = c::SOCK_STREAM;
     let mut res = ptr::null_mut();
     unsafe {
         match cvt_gai(c::getaddrinfo(c_host.as_ptr(), ptr::null(), &hints, &mut res)) {