Skip to content

Commit cc4bc6e

Browse files
committed
fix(shim/hook): when using older hook protocol, read the data into an owned buffer
1 parent d4bcfcd commit cc4bc6e

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

src/integrations/shim/hook.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,16 @@ impl SecurityHook {
9797
// Construct a shim input from the path.
9898
let input = ShimInput::SecurityHookPath(path);
9999

100+
// Convert the input to an owned data buffer.
101+
let input = match input.into_owned_data_buffer() {
102+
Ok(input) => input,
103+
// If an error occurs, log the error and return the not found status.
104+
Err(error) => {
105+
warn!("unable to read data to be authenticated: {}", error);
106+
return Status::NOT_FOUND;
107+
}
108+
};
109+
100110
// Verify the input, if it fails, call the original hook.
101111
if !Self::verify(input) {
102112
// Acquire the global hook state to grab the original hook.
@@ -116,7 +126,7 @@ impl SecurityHook {
116126
Err(error) => {
117127
warn!(
118128
"unable to acquire global hook state lock to call original hook: {}",
119-
error
129+
error,
120130
);
121131
return Status::LOAD_ERROR;
122132
}

0 commit comments

Comments
 (0)