diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bc7c3d..a7db47a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ This project follows [semantic versioning](http://semver.org). ### Unreleased - [changed] Logging more verbosely +- [fixed] Removing NULL-bytes from interface name ### v0.4 (2015-12-22) diff --git a/src/device.rs b/src/device.rs index e5f810f..338e026 100644 --- a/src/device.rs +++ b/src/device.rs @@ -28,7 +28,12 @@ impl Device { Type::Tap => unsafe { setup_tap_device(fd.as_raw_fd(), ifname_c.as_mut_ptr()) } }; match res { - 0 => Ok(Device{fd: fd, ifname: String::from_utf8(ifname_c).unwrap()}), + 0 => { + while ifname_c.last() == Some(&0) { + ifname_c.pop(); + } + Ok(Device{fd: fd, ifname: String::from_utf8(ifname_c).unwrap()}) + }, _ => Err(IoError::last_os_error()) } }