Closed etrombly closed 5 months ago
I think that the panic is triggered by cross-krb5
when it checks the length of the output token in order to return the result of a GSSAPI step. When there is no token, the resulting structure has a null pointer, and Deref
(in libgssapi
) calls slice::from_raw_parts()
with it: boom. Since checking the token length is a legitimate operation, this has to be handled in libgssapi
. So, raise the issue with libgssapi
and refer to this one.
Meanwhile, there are two workarounds I can think of:
Compile in debug mode with no debug assertions, by placing
[profile.dev]
debug-assertions = false
in Cargo.toml
.
Vendor libgssapi
and libgssapi-sys
, and patch libgssapi
with:
--- libgssapi-0.6.2/src/util.rs.orig 2024-05-17 09:47:33.280117007 +0200
+++ libgssapi-0.6.2/src/util.rs 2024-05-17 09:46:50.944798385 +0200
@@ -234,7 +234,11 @@
type Target = [u8];
fn deref(&self) -> &Self::Target {
unsafe { slice::from_raw_parts(self.0.value.cast(), self.0.length as usize) }
if self.0.value == ptr::null_mut() {
unsafe { slice::from_rawparts(ptr::NonNull::<>::dangling().as_ptr(), 0) }
} else {
unsafe { slice::from_raw_parts(self.0.value.cast(), self.0.length as usize) }
} } }
I'll keep the issue open until it's resolved in `libgssapi`.
Oh, I see that there's already estokes/libgssapi#23, so you don't have to open an issue there.
Thanks, I should have checked there first.
Closing, as 0.11.4 has just been published. It uses the updated libgssapi
which fixes the panic.
Thank you
Not sure if this is caused by libgssapi or by ldap3, but it looks like slice::from_raw_parts added some additional checks for the buffer being used.
Everything still works correctly with older rust versions.