Skip to content

Commit 847dff9

Browse files
committed
nfs/detect: fix nfs_procedure_parse return type
Was returning DetectNfsProcedureData as a pointer to DetectUintData<u32>, and free'ing it as such.
1 parent adc613b commit 847dff9

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

rust/src/nfs/detect.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ use super::types::{NfsProc2, NfsProc3, NfsProc4};
2929
use crate::core::STREAM_TOSERVER;
3030
use crate::detect::uint::{
3131
detect_match_uint, detect_parse_uint_enum, detect_parse_uint_inclusive, DetectUintData,
32-
SCDetectU32Free,
3332
};
3433
use crate::detect::{SIGMATCH_INFO_ENUM_UINT, SIGMATCH_INFO_MULTI_UINT, SIGMATCH_INFO_UINT32};
3534

@@ -67,7 +66,7 @@ fn nfs_procedure_parse_aux(s: &str) -> Option<DetectNfsProcedureData> {
6766

6867
unsafe extern "C" fn nfs_procedure_parse(
6968
ustr: *const std::os::raw::c_char,
70-
) -> *mut DetectUintData<u32> {
69+
) -> *mut DetectNfsProcedureData {
7170
let ft_name: &CStr = CStr::from_ptr(ustr); //unsafe
7271
if let Ok(s) = ft_name.to_str() {
7372
if let Some(ctx) = nfs_procedure_parse_aux(s) {
@@ -156,8 +155,8 @@ unsafe extern "C" fn nfs_procedure_match(
156155
}
157156

158157
unsafe extern "C" fn nfs_procedure_free(_de: *mut DetectEngineCtx, ctx: *mut c_void) {
159-
let ctx = cast_pointer!(ctx, DetectUintData<u32>);
160-
SCDetectU32Free(ctx);
158+
let ctx = cast_pointer!(ctx, DetectNfsProcedureData);
159+
std::mem::drop(Box::from_raw(ctx));
161160
}
162161

163162
#[no_mangle]

0 commit comments

Comments
 (0)