summaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorAlan Somers <asomers@gmail.com>2022-07-23 13:34:33 -0600
committerAlan Somers <asomers@gmail.com>2022-07-23 14:46:42 -0600
commit098aba2c4a4fed68222f7f48dbab72aedd9177d8 (patch)
treeb0c5563e2f6a104d4be9dcfb736ff2d601022c13 /src/lib.rs
parentb1e1a604a713432773fb6bc8590ff9291c70a0bb (diff)
downloadnix-098aba2c4a4fed68222f7f48dbab72aedd9177d8.zip
Fix SockaddrLike::from_raw with unaligned inputs
The major users of this function are functions like gethostname, which will always properly align their buffers. But out-of-crate consumers could manually construct an unaligned buffer. Handle that correctly. Enable Clippy's cast_ptr_alignment lint. It's disabled by default as it reports many false positives, but it would've caught this problem. Reported-by: Miri Fixes: 1769
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 68939209..770258dd 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -53,6 +53,7 @@
#![deny(missing_debug_implementations)]
#![warn(missing_docs)]
#![cfg_attr(docsrs, feature(doc_cfg))]
+#![deny(clippy::cast_ptr_alignment)]
// Re-exported external crates
pub use libc;