Skip to content

Commit d6a0b94

Browse files
committed
Fix typing on 32-bit architecture
Signed-off-by: Daiki Ueno <[email protected]>
1 parent 00024dd commit d6a0b94

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

crypto-auditing/src/types.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,15 @@ impl EventGroup {
114114
/// Deserializes an event group from bytes
115115
pub fn from_bytes(bytes: &[u8]) -> Result<Self, Box<dyn std::error::Error>> {
116116
let header = bytes.as_ptr() as *mut audit_event_header_st;
117-
let context = unsafe { format_context((*header).pid_tgid, (*header).context) };
118-
let ktime = unsafe { Duration::from_nanos((*header).ktime) };
117+
let context =
118+
unsafe { format_context((*header).pid_tgid.into(), (*header).context.into()) };
119+
let ktime = unsafe { Duration::from_nanos((*header).ktime.into()) };
119120
let event = match unsafe { (*header).type_ } {
120121
audit_event_type_t::AUDIT_EVENT_NEW_CONTEXT => {
121122
let raw_new_context = bytes.as_ptr() as *mut audit_new_context_event_st;
122-
let parent =
123-
unsafe { format_context((*header).pid_tgid, (*raw_new_context).parent) };
123+
let parent = unsafe {
124+
format_context((*header).pid_tgid.into(), (*raw_new_context).parent.into())
125+
};
124126
let origin = unsafe {
125127
(&(*raw_new_context).origin)[..(*raw_new_context).origin_size as usize].to_vec()
126128
};
@@ -143,7 +145,7 @@ impl EventGroup {
143145
end: ktime,
144146
events: vec![Event::Data {
145147
key: key.to_str()?.to_string(),
146-
value: EventData::Word((*raw_word_data).value),
148+
value: EventData::Word((*raw_word_data).value.into()),
147149
}],
148150
}
149151
}

0 commit comments

Comments
 (0)