}
pub fn free(&mut self) {
- if self.events != std::ptr::null_mut() {
+ if !self.events.is_null() {
core::sc_app_layer_decoder_events_free_events(&mut self.events);
}
if let Some(state) = self.de_state {
_rdir: *mut u8
) -> AppProto {
// Need at least 2 bytes.
- if input_len > 1 && input != std::ptr::null_mut() {
+ if input_len > 1 && !input.is_null() {
let slice = build_slice!(input, input_len as usize);
if probe(slice).is_ok() {
return ALPROTO_TEMPLATE;
let state = cast_pointer!(state, TemplateState);
- if input == std::ptr::null_mut() && input_len > 0 {
+ if input.is_null() && input_len > 0 {
// Here we have a gap signaled by the input being null, but a greater
// than 0 input_len which provides the size of the gap.
state.on_request_gap(input_len);
};
let state = cast_pointer!(state, TemplateState);
- if input == std::ptr::null_mut() && input_len > 0 {
+ if input.is_null() && input_len > 0 {
// Here we have a gap signaled by the input being null, but a greater
// than 0 input_len which provides the size of the gap.
state.on_response_gap(input_len);
if flags & (core::STREAM_START|core::STREAM_MIDSTREAM) == (core::STREAM_START|core::STREAM_MIDSTREAM) {
state.ts_gap = true;
}
- if input_len > 0 && input != std::ptr::null_mut() {
+ if input_len > 0 && !input.is_null() {
let buf = build_slice!(input, input_len as usize);
state.flow = Some(flow);
return state.handle_input_data(buf, core::STREAM_TOSERVER);
state.tc_gap = true;
}
if input_len > 0 {
- if input != std::ptr::null_mut() {
+ if !input.is_null() {
let buf = build_slice!(input, input_len as usize);
state.flow = Some(flow);
return state.handle_input_data(buf, core::STREAM_TOCLIENT);
input: *const u8, input_len: u32, _data: *const std::os::raw::c_void, _flags: u8,
) -> AppLayerResult {
let state = cast_pointer!(state, DCERPCUDPState);
- if input_len > 0 && input != std::ptr::null_mut() {
+ if input_len > 0 && !input.is_null() {
let buf = build_slice!(input, input_len as usize);
return state.handle_input_data(buf);
}
#[no_mangle]
pub unsafe extern "C" fn rs_dcerpc_iface_free(ptr: *mut c_void) {
- if ptr != std::ptr::null_mut() {
+ if !ptr.is_null() {
std::mem::drop(Box::from_raw(ptr as *mut DCEIfaceData));
}
}
#[no_mangle]
pub unsafe extern "C" fn rs_dcerpc_opnum_free(ptr: *mut c_void) {
- if ptr != std::ptr::null_mut() {
+ if !ptr.is_null() {
std::mem::drop(Box::from_raw(ptr as *mut DCEOpnumData));
}
}
}
pub fn free(&mut self) {
- if self.events != std::ptr::null_mut() {
+ if !self.events.is_null() {
sc_app_layer_decoder_events_free_events(&mut self.events);
}
match self.de_state {
#[no_mangle]
pub unsafe extern "C" fn rs_dns_detect_opcode_free(ptr: *mut c_void) {
- if ptr != std::ptr::null_mut() {
+ if !ptr.is_null() {
std::mem::drop(Box::from_raw(ptr as *mut DetectDnsOpcode));
}
}
}
pub fn free(&mut self) {
- if self.events != std::ptr::null_mut() {
+ if !self.events.is_null() {
core::sc_app_layer_decoder_events_free_events(&mut self.events);
}
match self.de_state {
-> AppLayerResult {
let state = cast_pointer!(state, DNSState);
if input_len > 0 {
- if input != std::ptr::null_mut() {
+ if !input.is_null() {
let buf = std::slice::from_raw_parts(input, input_len as usize);
return state.parse_request_tcp(buf);
}
-> AppLayerResult {
let state = cast_pointer!(state, DNSState);
if input_len > 0 {
- if input != std::ptr::null_mut() {
+ if !input.is_null() {
let buf = std::slice::from_raw_parts(input, input_len as usize);
return state.parse_response_tcp(buf);
}
}
pub fn free(&mut self) {
- if self.events != std::ptr::null_mut() {
+ if !self.events.is_null() {
core::sc_app_layer_decoder_events_free_events(&mut self.events);
}
if let Some(state) = self.de_state {
core::sc_detect_engine_state_free(state);
}
- if self.file_range != std::ptr::null_mut() {
+ if !self.file_range.is_null() {
match unsafe { SC } {
None => panic!("BUG no suricata_config"),
Some(c) => {
match range::http2_parse_check_content_range(&value) {
Ok((_, v)) => {
range::http2_range_open(self, &v, flow, sfcm, flags, decompressed);
- if over && self.file_range != std::ptr::null_mut() {
+ if over && !self.file_range.is_null() {
range::http2_range_close(self, files, flags, &[])
}
}
}
}
} else {
- if self.file_range != std::ptr::null_mut() {
+ if !self.file_range.is_null() {
if over {
range::http2_range_close(self, files, flags, decompressed)
} else {
pub unsafe extern "C" fn rs_http2_probing_parser_tc(
_flow: *const Flow, _direction: u8, input: *const u8, input_len: u32, _rdir: *mut u8,
) -> AppProto {
- if input != std::ptr::null_mut() {
+ if !input.is_null() {
let slice = build_slice!(input, input_len as usize);
match parser::http2_parse_frame_header(slice) {
Ok((_, header)) => {
let state = HTTP2State::new();
let boxed = Box::new(state);
let r = Box::into_raw(boxed) as *mut _;
- if orig_state != std::ptr::null_mut() {
+ if !orig_state.is_null() {
//we could check ALPROTO_HTTP1 == orig_proto
unsafe {
HTTP2MimicHttp1Request(orig_state, r);
}
pub fn free(&mut self) {
- if self.events != std::ptr::null_mut() {
+ if !self.events.is_null() {
core::sc_app_layer_decoder_events_free_events(&mut self.events);
}
if let Some(state) = self.de_state {
return ALPROTO_FAILED;
}
- if input != std::ptr::null_mut() {
+ if !input.is_null() {
let slice = build_slice!(input, input_len as usize);
if probe(slice, direction, rdir) {
return ALPROTO_IKE ;
impl Drop for KRB5Transaction {
fn drop(&mut self) {
- if self.events != std::ptr::null_mut() {
+ if !self.events.is_null() {
core::sc_app_layer_decoder_events_free_events(&mut self.events);
}
if let Some(state) = self.de_state {
}
pub fn free(&mut self) {
- if self.events != std::ptr::null_mut() {
+ if !self.events.is_null() {
core::sc_app_layer_decoder_events_free_events(&mut self.events);
}
if let Some(state) = self.de_state {
pub fn free(&mut self) {
debug_validate_bug_on!(self.tx_data.files_opened > 1);
debug_validate_bug_on!(self.tx_data.files_logged > 1);
- if self.events != std::ptr::null_mut() {
+ if !self.events.is_null() {
sc_app_layer_decoder_events_free_events(&mut self.events);
}
match self.de_state {
}
fn free(&mut self) {
- if self.events != std::ptr::null_mut() {
+ if !self.events.is_null() {
core::sc_app_layer_decoder_events_free_events(&mut self.events);
}
}
pub unsafe extern "C" fn rs_rdp_probe_ts_tc(
_flow: *const Flow, _direction: u8, input: *const u8, input_len: u32, _rdir: *mut u8,
) -> AppProto {
- if input != std::ptr::null_mut() {
+ if !input.is_null() {
// probe bytes for `rdp` protocol pattern
let slice = build_slice!(input, input_len as usize);
}
pub fn free(&mut self) {
- if self.events != std::ptr::null_mut() {
+ if !self.events.is_null() {
core::sc_app_layer_decoder_events_free_events(&mut self.events);
}
if let Some(state) = self.de_state {
impl Drop for SIPTransaction {
fn drop(&mut self) {
- if self.events != std::ptr::null_mut() {
+ if !self.events.is_null() {
core::sc_app_layer_decoder_events_free_events(&mut self.events);
}
if let Some(state) = self.de_state {
pub fn free(&mut self) {
debug_validate_bug_on!(self.tx_data.files_opened > 1);
debug_validate_bug_on!(self.tx_data.files_logged > 1);
- if self.events != std::ptr::null_mut() {
+ if !self.events.is_null() {
sc_app_layer_decoder_events_free_events(&mut self.events);
}
match self.de_state {
}
fn free(&mut self) {
- if self.events != std::ptr::null_mut() {
+ if !self.events.is_null() {
core::sc_app_layer_decoder_events_free_events(&mut self.events);
}
}
}
pub fn free(&mut self) {
- if self.events != std::ptr::null_mut() {
+ if !self.events.is_null() {
core::sc_app_layer_decoder_events_free_events(&mut self.events);
}
if let Some(state) = self.de_state {