changeset 149:14708d9061dc

Add safety section to BinaryPayload::total_bytes.
author Paul Fisher <paul@pfish.zone>
date Mon, 07 Jul 2025 12:30:25 -0400
parents 4b3a5095f68c
children 036eb312baea
files libpam-sys/libpam-sys-helpers/src/lib.rs
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpam-sys/libpam-sys-helpers/src/lib.rs	Mon Jul 07 12:11:43 2025 -0400
+++ b/libpam-sys/libpam-sys-helpers/src/lib.rs	Mon Jul 07 12:30:25 2025 -0400
@@ -340,6 +340,10 @@
     }
 
     /// The total storage needed for the message, including header.
+    ///
+    /// # Safety
+    ///
+    /// The pointer must point to a valid `BinaryPayload`.
     pub unsafe fn total_bytes(this: *const Self) -> usize {
         let header = this.as_ref().unwrap_unchecked();
         u32::from_be_bytes(header.total_bytes_u32be) as usize