From: Russ Combs (rucombs) Date: Tue, 16 Mar 2021 15:57:26 +0000 (+0000) Subject: Merge pull request #2790 in SNORT/snort3 from ~RUCOMBS/snort3:stylez to master X-Git-Tag: 3.1.3.0~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3c4ad9108163ed4dbf82a2c52a7143e0b4afff7c;p=thirdparty%2Fsnort3.git Merge pull request #2790 in SNORT/snort3 from ~RUCOMBS/snort3:stylez to master Squashed commit of the following: commit 498f2ec03eda4d563554358acb56da12fa323a33 Author: russ Date: Thu Mar 11 11:13:08 2021 -0500 style: Change C++ comment NULL to null To make inappropriate use of NULL vs nullptr easier to spot. Also, keep MPLS "NULL label" comments since that is normative. commit 3cf4fc89961d26585a091ca2f04526f3098c9302 Author: russ Date: Thu Mar 11 10:51:59 2021 -0500 style: Remove unnecessary cruft commit e8ec4040b2deabe46d7322191fc4087e92525d8e Author: russ Date: Thu Mar 11 10:38:41 2021 -0500 style: Remove unused cruft --- diff --git a/src/codecs/ip/cd_esp.cc b/src/codecs/ip/cd_esp.cc index 211f30e06..70ce93b7e 100644 --- a/src/codecs/ip/cd_esp.cc +++ b/src/codecs/ip/cd_esp.cc @@ -111,7 +111,7 @@ bool EspCodec::decode(const RawData& raw, CodecData& codec, DecodeData& snort) /* The Authentication Data at the end of the packet is variable-length. RFC 2406 says that Encryption and Authentication algorithms MUST NOT - both be NULL, so we assume NULL Encryption and some other Authentication. + both be null, so we assume null Encryption and some other Authentication. The mandatory algorithms for Authentication are HMAC-MD5-96 and HMAC-SHA-1-96, so we assume a 12-byte authentication data at the end. */ diff --git a/src/codecs/ip/cd_icmp4.cc b/src/codecs/ip/cd_icmp4.cc index 9f31bb111..69fa66370 100644 --- a/src/codecs/ip/cd_icmp4.cc +++ b/src/codecs/ip/cd_icmp4.cc @@ -337,7 +337,7 @@ void Icmp4Codec::log(TextLog* const log, const uint8_t* raw_pkt, { const icmp::ICMPHdr* const icmph = reinterpret_cast(raw_pkt); - /* 32 digits plus 7 colons and a NULL byte */ + /* 32 digits plus 7 colons and a null byte */ char buf[8*4 + 7 + 1]; TextLog_Print(log, "Type:%d Code:%d ", icmph->type, icmph->code); TextLog_Puts(log, "\n\t"); diff --git a/src/codecs/ip/cd_tcp.cc b/src/codecs/ip/cd_tcp.cc index ebd677658..38dae7b6f 100644 --- a/src/codecs/ip/cd_tcp.cc +++ b/src/codecs/ip/cd_tcp.cc @@ -569,7 +569,7 @@ void TcpCodec::log(TextLog* const text_log, const uint8_t* raw_pkt, /* print TCP flags */ CreateTCPFlagString(tcph, tcpFlags); - TextLog_Puts(text_log, tcpFlags); /* We don't care about the NULL */ + TextLog_Puts(text_log, tcpFlags); /* We don't care about the null */ /* print other TCP info */ TextLog_Print(text_log, " SrcPort:%u DstPort:%u\n\tSeq: 0x%lX Ack: 0x%lX " diff --git a/src/decompress/file_decomp_pdf.cc b/src/decompress/file_decomp_pdf.cc index 9c49d4b03..7e60bf08d 100644 --- a/src/decompress/file_decomp_pdf.cc +++ b/src/decompress/file_decomp_pdf.cc @@ -315,7 +315,7 @@ static inline fd_status_t Pop_State(fd_PDF_Parse_t* p) return File_Decomp_OK; } -/* If there's a previous state on the stack, return a pointer to it, else return NULL */ +/* If there's a previous state on the stack, return a pointer to it, else return null */ static inline fd_PDF_Parse_Stack_t* Get_Previous_State(fd_PDF_Parse_t* p) { if ( p->Parse_Stack_Index == 0 ) diff --git a/src/detection/fp_create.cc b/src/detection/fp_create.cc index 059a14f1c..5519a5d61 100644 --- a/src/detection/fp_create.cc +++ b/src/detection/fp_create.cc @@ -404,7 +404,7 @@ static int pmx_create_tree(SnortConfig* sc, void* id, void** existing_tree, Mpse if ( !*existing_tree ) return -1; - /* NULL input id (PMX *), last call for this pattern state */ + /* null input id (PMX *), last call for this pattern state */ return finalize_detection_option_tree(sc, (detection_option_tree_root_t*)*existing_tree); } diff --git a/src/detection/tag.cc b/src/detection/tag.cc index bc46e2c00..61b5bea1b 100644 --- a/src/detection/tag.cc +++ b/src/detection/tag.cc @@ -205,7 +205,7 @@ static inline unsigned int memory_per_node(XHash* hash) * @param hash - pointer to XHash that should point to either ssn_tag_cache_ptr * or host_tag_cache_ptr. * - * @returns a pointer to new TagNode or NULL if memory couldn't * be allocated + * @returns a pointer to new TagNode or null if memory couldn't * be allocated */ static TagNode* TagAlloc( XHash* hash diff --git a/src/events/sfeventq.cc b/src/events/sfeventq.cc index 55d2cd560..a2a26648c 100644 --- a/src/events/sfeventq.cc +++ b/src/events/sfeventq.cc @@ -40,7 +40,7 @@ ** sfeventq_event_alloc() allocates the memory for storing the event. ** sfeventq_add() adds the event and prioritizes the event in the queue. ** You should only allocate and add one event at a time. Otherwise, -** event_alloc() will return NULL on memory exhaustion. +** event_alloc() will return null on memory exhaustion. ** ** 3. Event actions ** sfeventq_action() will call the provided function on the initialized @@ -88,13 +88,13 @@ SF_EVENTQ* sfeventq_new(int max_nodes, int log_nodes, int event_size) ** Allocate the memory for an event to add to the event queue. This ** function is meant to be called first, the event structure filled in, ** and then added to the queue. While you can allocate several times before -** adding to the queue, this is not recommended as you may get a NULL ptr +** adding to the queue, this is not recommended as you may get a null ptr ** if you allocate more than the max node number. ** ** @return void * ** -** @retval NULL unable to allocate memory. -** @retval !NULL ptr to memory. +** @retval null - unable to allocate memory. +** @retval !null - ptr to memory. */ void* sfeventq_event_alloc(SF_EVENTQ* eq) { @@ -167,8 +167,8 @@ void sfeventq_free(SF_EVENTQ* eq) ** ** @return SF_EVENTQ_NODE * ** -** @retval NULL resource exhaustion and event is lower priority than last node -** @retval !NULL ptr to node memory. +** @retval null - resource exhaustion and event is lower priority than last node +** @retval !null - ptr to node memory. */ static SF_EVENTQ_NODE* get_eventq_node(SF_EVENTQ* eq, void*) { @@ -195,7 +195,7 @@ int sfeventq_add(SF_EVENTQ* eq, void* event) assert(event); /* - ** If get_eventq_node() returns NULL, this means that + ** If get_eventq_node() returns null, this means that ** we have exhausted the eventq and the incoming event ** is lower in priority then the last ranked event. ** So we just drop it. diff --git a/src/filters/sfrf_test.cc b/src/filters/sfrf_test.cc index d250661c2..ccc8c27b9 100644 --- a/src/filters/sfrf_test.cc +++ b/src/filters/sfrf_test.cc @@ -862,7 +862,7 @@ static EventData evData[] = static void PrintTests() { unsigned i; - EventData* prev = NULL; + EventData* prev = nullptr; for ( i = 0; i < NUM_EVENTS; i++ ) { diff --git a/src/filters/sfthd.cc b/src/filters/sfthd.cc index 3d1c06eed..6e0ab02e3 100644 --- a/src/filters/sfthd.cc +++ b/src/filters/sfthd.cc @@ -83,7 +83,7 @@ XHash* sfthd_local_new(unsigned bytes) sizeof(THD_IP_NODE)); #ifdef THD_DEBUG - if (local_hash == NULL) + if ( !local_hash ) printf("Could not allocate the sfxhash table\n"); #endif @@ -98,7 +98,7 @@ XHash* sfthd_global_new(unsigned bytes) sizeof(THD_IP_NODE)); #ifdef THD_DEBUG - if (global_hash == NULL) + if ( !global_hash ) printf("Could not allocate the sfxhash table\n"); #endif diff --git a/src/ips_options/asn1_util.cc b/src/ips_options/asn1_util.cc index d85e6a990..0384d1d3e 100644 --- a/src/ips_options/asn1_util.cc +++ b/src/ips_options/asn1_util.cc @@ -91,8 +91,8 @@ static void asn1_init_node_index() ** ** @return ASN1_TYPE * ** -** @retval NULL memory allocation failed -** @retval !NULL function successful +** @retval null - memory allocation failed +** @retval !null - function successful */ static ASN1_TYPE* asn1_node_alloc() { @@ -159,7 +159,7 @@ void asn1_free_mem() ** @retval ASN1_OK function successful ** @retval ASN1_ERR_OVERLONG_LEN tag number too large ** @retval ASN1_ERR_OOB encoding goes out of bounds -** @retval ASN1_ERR_NULL_MEM function arguments are NULL +** @retval ASN1_ERR_NULL_MEM function arguments are null */ static int asn1_decode_tag_num_ext(ASN1_DATA* asn1_data, unsigned* tag_num) { @@ -210,7 +210,7 @@ static int asn1_decode_tag_num_ext(ASN1_DATA* asn1_data, unsigned* tag_num) ** ** @return integer ** -** @retval ASN1_ERR_NULL_MEM function arguments are NULL +** @retval ASN1_ERR_NULL_MEM function arguments are null ** @retval ASN1_ERR_OOB buffer out of bounds ** @retval ASN1_ERR_INVALID_BER_TAG_LEN tag num too large or bad encoding ** @retval ASN1_OK function ok @@ -299,7 +299,7 @@ static int asn1_decode_len_type(const uint8_t* data) ** ** @return integer ** -** @retval ASN1_ERR_NULL_MEM function arguments NULL +** @retval ASN1_ERR_NULL_MEM function arguments null ** @retval ASN1_ERR_OVERLONG_LEN length to long for us to decode ** @retval ASN1_ERR_OOB out of bounds condition ** @retval ASN1_OK function successful @@ -364,7 +364,7 @@ static int asn1_decode_len_ext(ASN1_DATA* asn1_data, unsigned* size) ** ** @return integer ** -** @retval ASN1_ERR_NULL_MEM function arguments NULL +** @retval ASN1_ERR_NULL_MEM function arguments null ** @retval ASN1_ERR_FATAL should never get this ** @retval ASN1_ERR_OOB out of bounds condition ** @retval ASN1_OK function successful @@ -498,7 +498,7 @@ static int asn1_decode_type(const uint8_t** data, unsigned* len, ASN1_TYPE** asn /* ** Check len first, because if it's 0, then we already decoded a valid ** construct. We let the caller know this, by returning OK, but setting - ** the asn1_type ptr to NULL. + ** the asn1_type ptr to null. */ if (*len == 0) return ASN1_OK; diff --git a/src/ips_options/ips_cvs.cc b/src/ips_options/ips_cvs.cc index 41f7009de..bbb9ab605 100644 --- a/src/ips_options/ips_cvs.cc +++ b/src/ips_options/ips_cvs.cc @@ -213,7 +213,7 @@ static int CvsDecode(const uint8_t* data, uint16_t data_len, ** NAME ** CvsCmdCompare ** Compares two pointers to char to see if they are equal. -** The first arg is NULL terminated. The second is not and +** The first arg is null terminated. The second is not and ** it's length is passed in. ** */ @@ -245,7 +245,7 @@ static int CvsCmdCompare(const char* cmd, const uint8_t* pkt_cmd, int pkt_cmd_le ** the replacement '\0' is put into the structure's command ** argument member. If there isn't a space, the entire line ** is put in the command and the command argument is set to -** NULL. +** null. ** */ /** diff --git a/src/ips_options/ips_flags.cc b/src/ips_options/ips_flags.cc index e45b57418..3c6d4d9ea 100644 --- a/src/ips_options/ips_flags.cc +++ b/src/ips_options/ips_flags.cc @@ -245,7 +245,7 @@ static void flags_parse_test(const char* rule, TcpFlagCheckData* idx) default: ParseError( "bad TCP flag = '%c'" - "Valid options: UAPRSFCE or 0 for NO flags (e.g. NULL scan)," + "Valid options: UAPRSFCE or 0 for NO flags (e.g. null scan)," " and !, + or * for modifiers", *fptr); return; diff --git a/src/ips_options/ips_pcre.cc b/src/ips_options/ips_pcre.cc index eb3abbb63..db8c4a427 100644 --- a/src/ips_options/ips_pcre.cc +++ b/src/ips_options/ips_pcre.cc @@ -116,8 +116,8 @@ static void pcre_check_anchored(PcreData* pcre_data) switch (rc) { /* pcre_fullinfo fails for the following: - * PCRE_ERROR_NULL - the argument code was NULL - * the argument where was NULL + * PCRE_ERROR_NULL - the argument code was null + * the argument where was null * PCRE_ERROR_BADMAGIC - the "magic number" was not found * PCRE_ERROR_BADOPTION - the value of what was invalid * so a failure here means we passed in bad values and we should @@ -128,7 +128,7 @@ static void pcre_check_anchored(PcreData* pcre_data) break; case PCRE_ERROR_NULL: - ParseError("pcre_fullinfo: code and/or where were NULL."); + ParseError("pcre_fullinfo: code and/or where were null."); return; case PCRE_ERROR_BADMAGIC: diff --git a/src/log/log.cc b/src/log/log.cc index 2d67911f2..fe556e1ac 100644 --- a/src/log/log.cc +++ b/src/log/log.cc @@ -40,7 +40,7 @@ using namespace snort; namespace snort { -// Input is packet and an nine-byte (including NULL) character array. Results +// Input is packet and an nine-byte (including null) character array. Results // are put into the character array. void CreateTCPFlagString(const tcp::TCPHdr* const tcph, char* flagBuffer) { diff --git a/src/log/log_text.cc b/src/log/log_text.cc index abc64c500..29023d504 100644 --- a/src/log/log_text.cc +++ b/src/log/log_text.cc @@ -583,7 +583,7 @@ void LogTCPHeader(TextLog* log, Packet* p) } /* print TCP flags */ CreateTCPFlagString(tcph, tcpFlags); - TextLog_Puts(log, tcpFlags); /* We don't care about the NULL */ + TextLog_Puts(log, tcpFlags); /* We don't care about the null */ /* print other TCP info */ TextLog_Print(log, " Seq: 0x%lX Ack: 0x%lX Win: 0x%X TcpLen: %d", @@ -778,7 +778,7 @@ static void LogICMPEmbeddedIP(TextLog* log, Packet* p) */ void LogICMPHeader(TextLog* log, Packet* p) { - /* 32 digits plus 7 colons and a NULL byte */ + /* 32 digits plus 7 colons and a null byte */ char buf[8*4 + 7 + 1]; if (p->ptrs.icmph == nullptr) diff --git a/src/loggers/alert_unixsock.cc b/src/loggers/alert_unixsock.cc index 5c7936cf4..bf0514a5a 100644 --- a/src/loggers/alert_unixsock.cc +++ b/src/loggers/alert_unixsock.cc @@ -58,7 +58,7 @@ struct Alertpkt uint32_t nethdr; /* network header offset. (ip etc...) */ uint32_t transhdr; /* transport header offset (tcp/udp/icmp ..) */ uint32_t data; - uint32_t val; /* which fields are valid. (NULL could be valid also) */ + uint32_t val; /* which fields are valid. (null could be valid also) */ /* Packet struct --> was null */ #define NOPACKET_STRUCT 0x1 /* no transport headers in packet */ diff --git a/src/main/snort.cc b/src/main/snort.cc index 71fa28bdb..679aa4ec7 100644 --- a/src/main/snort.cc +++ b/src/main/snort.cc @@ -279,9 +279,7 @@ bool Snort::drop_privileges() return false; } - initializing = false; privileges_dropped = true; - return true; } @@ -317,8 +315,6 @@ void Snort::term() const SnortConfig* sc = SnortConfig::get_conf(); - initializing = false; // just in case we cut out early - memory::MemoryCap::print(); IpsManager::global_term(sc); @@ -380,13 +376,9 @@ void Snort::clean_exit(int) // public methods //------------------------------------------------------------------------- -bool Snort::initializing = true; bool Snort::reloading = false; bool Snort::privileges_dropped = false; -bool Snort::is_starting() -{ return initializing; } - bool Snort::is_reloading() { return reloading; } diff --git a/src/main/snort.h b/src/main/snort.h index c6eee51fd..eb190a34c 100644 --- a/src/main/snort.h +++ b/src/main/snort.h @@ -47,7 +47,6 @@ public: static void do_pidfile(); static void cleanup(); - static bool is_starting(); static bool has_dropped_privileges(); SO_PUBLIC static bool is_reloading(); diff --git a/src/network_inspectors/appid/detector_plugins/http_url_patterns.h b/src/network_inspectors/appid/detector_plugins/http_url_patterns.h index e8691793b..93d434191 100644 --- a/src/network_inspectors/appid/detector_plugins/http_url_patterns.h +++ b/src/network_inspectors/appid/detector_plugins/http_url_patterns.h @@ -101,7 +101,7 @@ struct DetectorHTTPPattern { if( !pat ) { - snort::ErrorMessage("HTTP pattern string is NULL."); + snort::ErrorMessage("HTTP pattern string is null."); return false; } diff --git a/src/network_inspectors/appid/service_plugins/test/service_rsync_test.cc b/src/network_inspectors/appid/service_plugins/test/service_rsync_test.cc index f9a5e251c..754fb46ff 100644 --- a/src/network_inspectors/appid/service_plugins/test/service_rsync_test.cc +++ b/src/network_inspectors/appid/service_plugins/test/service_rsync_test.cc @@ -37,13 +37,13 @@ #include #include -ServiceRSYNCData* fake_rsync_data = NULL; +ServiceRSYNCData* fake_rsync_data = nullptr; TEST_GROUP(service_rsync) { void setup() { - fake_rsync_data = NULL; + fake_rsync_data = nullptr; } void teardown() diff --git a/src/network_inspectors/appid/tp_lib_handler.h b/src/network_inspectors/appid/tp_lib_handler.h index 7c96c4c99..b7abbaf01 100644 --- a/src/network_inspectors/appid/tp_lib_handler.h +++ b/src/network_inspectors/appid/tp_lib_handler.h @@ -28,7 +28,7 @@ class AppIdConfig; class OdpContext; // This needs to be exported by any third party .so library. -// Must return NULL if it fails to create the object. +// Must return null if it fails to create the object. typedef ThirdPartyAppIdContext* (* TpAppIdCreateCtxt)(ThirdPartyConfig& ); typedef ThirdPartyAppIdSession* (* TpAppIdCreateSession)(ThirdPartyAppIdContext& ctxt); typedef int (* TpAppIdPfini)(); diff --git a/src/network_inspectors/normalize/norm.h b/src/network_inspectors/normalize/norm.h index 6cbbec385..3e74c3c19 100644 --- a/src/network_inspectors/normalize/norm.h +++ b/src/network_inspectors/normalize/norm.h @@ -42,7 +42,7 @@ struct NormalizerConfig uint8_t normalizer_options[32]; // these must be in the same order PROTO_IDs are defined! - // if entry is NULL, proto doesn't have normalization or it is disabled + // if entry is null, proto doesn't have normalization or it is disabled NormalFunc normalizers[snort::PacketManager::max_protocols()]; }; diff --git a/src/network_inspectors/reputation/reputation_module.cc b/src/network_inspectors/reputation/reputation_module.cc index 44a3e4a3d..6da6c6871 100644 --- a/src/network_inspectors/reputation/reputation_module.cc +++ b/src/network_inspectors/reputation/reputation_module.cc @@ -153,7 +153,7 @@ bool ReputationModule::set(const char*, Value& v, SnortConfig*) ReputationConfig* ReputationModule::get_data() { - // FIXIT-M: this needs to be set to NULL prior to returning here. + // FIXIT-M: this needs to be set to null prior to returning here. // If we do that, though, reload module will error out, even when // reputation has been properly configured (on startup) in lua. return conf; diff --git a/src/ports/port_object.cc b/src/ports/port_object.cc index 50d424cab..32770d392 100644 --- a/src/ports/port_object.cc +++ b/src/ports/port_object.cc @@ -515,7 +515,7 @@ void PortObjectPrintPortsRaw(PortObject* po) * 30 bytes. For the entire list, need room for spaces and brackets and * potential negations. Or: * list_size * (30 + 1space_for_each_element, + - * 1potential_negation) + surrounding_whitespace + brackets + NULL */ + * 1potential_negation) + surrounding_whitespace + brackets + null */ bufsize = po->item_list->count * (30 + 1 + 1) + 5; buf = (char*)snort_calloc(bufsize); diff --git a/src/protocols/packet_manager.cc b/src/protocols/packet_manager.cc index 7fd5fd503..7c6628fd6 100644 --- a/src/protocols/packet_manager.cc +++ b/src/protocols/packet_manager.cc @@ -69,7 +69,6 @@ const std::array PacketManager::stat_na }; // Encoder Foo -static THREAD_LOCAL PegCount total_rebuilt_pkts = 0; static THREAD_LOCAL std::array* s_pkt; void PacketManager::thread_init() @@ -720,7 +719,6 @@ int PacketManager::format_tcp( c->context->pkth->pktlen = 0; c->context->pkth->ts = p->pkth->ts; - total_rebuilt_pkts++; return 0; } @@ -816,7 +814,6 @@ int PacketManager::encode_format( c->context->pkth->ts = p->pkth->ts; layer::set_packet_pointer(c); // ensure we are looking at the new packet - total_rebuilt_pkts++; return 0; } @@ -888,9 +885,6 @@ void PacketManager::encode_update(Packet* p) // codec support and statistics //------------------------------------------------------------------------- -PegCount PacketManager::get_rebuilt_packet_count() -{ return total_rebuilt_pkts; } - uint16_t PacketManager::encode_get_max_payload(const Packet* p) { if ( !p->num_layers ) diff --git a/src/protocols/packet_manager.h b/src/protocols/packet_manager.h index 27e85c552..0c0f5813f 100644 --- a/src/protocols/packet_manager.h +++ b/src/protocols/packet_manager.h @@ -100,9 +100,6 @@ public: /* codec support and statistics */ - // get the number of packets which have been rebuilt by this thread - static PegCount get_rebuilt_packet_count(); - // get the max payload for the current packet static uint16_t encode_get_max_payload(const Packet*); diff --git a/src/service_inspectors/cip/cip_parsing.cc b/src/service_inspectors/cip/cip_parsing.cc index 9b6e0c9fa..7ccd822c7 100644 --- a/src/service_inspectors/cip/cip_parsing.cc +++ b/src/service_inspectors/cip/cip_parsing.cc @@ -19,7 +19,7 @@ // cip_parsing.cc author RA/Cisco /* Description: Data parsing for EtherNet/IP and CIP formats. - Note: No pointer parameters to these functions can be passed as NULL. */ + Note: No pointer parameters to these functions can be passed as null. */ #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/src/service_inspectors/dce_rpc/dce_common.h b/src/service_inspectors/dce_rpc/dce_common.h index 0e8ebf5b4..f40f5da88 100644 --- a/src/service_inspectors/dce_rpc/dce_common.h +++ b/src/service_inspectors/dce_rpc/dce_common.h @@ -184,7 +184,7 @@ struct DCE2_Roptions int opnum; /* Set to sentinel if not applicable */ /* dce_stub_data */ - const uint8_t* stub_data; /* Set to NULL if not applicable */ + const uint8_t* stub_data; /* Set to null if not applicable */ }; enum DCE2_SsnFlag diff --git a/src/service_inspectors/dce_rpc/dce_list.cc b/src/service_inspectors/dce_rpc/dce_list.cc index b2efb9e26..53b900d78 100644 --- a/src/service_inspectors/dce_rpc/dce_list.cc +++ b/src/service_inspectors/dce_rpc/dce_list.cc @@ -53,11 +53,11 @@ static void DCE2_ListInsertBefore(DCE2_List*, DCE2_ListNode*, DCE2_ListNode*); * for inserting, finding, etc. * DCE2_ListDataFree * An optional function to call to free data in the list. - * If NULL is passed in, the user will have to manually free + * If null is passed in, the user will have to manually free * the data. * DCE2_ListKeyFree * An optional function to call to free keys used in the list. - * If NULL is passed in, the user will have to manually free + * If null is passed in, the user will have to manually free * the keys. * int * Flags that affect processing of the list. @@ -66,7 +66,7 @@ static void DCE2_ListInsertBefore(DCE2_List*, DCE2_ListNode*, DCE2_ListNode*); * Returns: * DCE2_List * * Pointer to a valid list object. - * NULL if an error occurs. + * Null if an error occurs. * ********************************************************************/ DCE2_List* DCE2_ListNew(DCE2_ListType type, DCE2_ListKeyCompare kc, @@ -221,7 +221,7 @@ static void DCE2_ListInsertBefore(DCE2_List* list, DCE2_ListNode* insert, DCE2_L * in the list and no duplicates are allowed. * DCE2_RET__SUCCESS if a new node with key and data is * successfully inserted into the list. - * DCE2_RET__ERROR if a NULL list object was passed in. + * DCE2_RET__ERROR if a null list object was passed in. * ********************************************************************/ DCE2_Ret DCE2_ListInsert(DCE2_List* list, void* key, void* data) @@ -309,7 +309,7 @@ DCE2_Ret DCE2_ListInsert(DCE2_List* list, void* key, void* data) * Returns: * void * * The data in the first node in the list. - * NULL if the list object passed in is NULL, or there are + * Null if the list object passed in is null, or there are * no items in the list. * ********************************************************************/ @@ -342,7 +342,7 @@ void* DCE2_ListFirst(DCE2_List* list) * Returns: * void * * The data in the next node in the list. - * NULL if the list object passed in is NULL, or we are at + * Null if the list object passed in is null, or we are at * the end of the list and there are no next nodes. * ********************************************************************/ @@ -372,7 +372,7 @@ void* DCE2_ListNext(DCE2_List* list) * * Removes all of the nodes in a list. Does not delete the list * object itself. Calls data free and key free functions for - * data and key if they are not NULL. + * data and key if they are not null. * * Arguments: * DCE2_List * @@ -446,7 +446,7 @@ void DCE2_ListDestroy(DCE2_List* list) * void * * If the key is found, the data associated with the node * is returned. - * NULL is returned if the item cannot be found given the key. + * Null is returned if the item cannot be found given the key. * ********************************************************************/ void* DCE2_ListFind(DCE2_List* list, void* key) @@ -579,7 +579,7 @@ DCE2_Ret DCE2_ListFindKey(DCE2_List* list, void* key) * Returns: * DCE2_Ret * DCE2_RET__ERROR if a node in the list with the specified - * key cannot be found or the list object passed in is NULL. + * key cannot be found or the list object passed in is null. * DCE2_RET__SUCCESS if the node is successfully removed from * the list. * @@ -688,7 +688,7 @@ void DCE2_ListRemoveCurrent(DCE2_List* list) * Arguments: * DCE2_QueueDataFree * An optional free function for the data inserted into - * the queue. If NULL is passed in, the user will be + * the queue. If null is passed in, the user will be * responsible for freeing data left in the queue. * * Returns: @@ -719,7 +719,7 @@ DCE2_Queue* DCE2_QueueNew(DCE2_QueueDataFree df) * * Returns: * DCE2_Ret - * DCE2_RET__ERROR if the queue object passed in is NULL. + * DCE2_RET__ERROR if the queue object passed in is null. * DCE2_RET__SUCCESS if the data is successfully added to * the queue. * @@ -766,8 +766,8 @@ DCE2_Ret DCE2_QueueEnqueue(DCE2_Queue* queue, void* data) * Returns: * void * * The data in the first node in the queue. - * NULL if there are no items in the queue or the queue object - * passed in is NULL. + * Null if there are no items in the queue or the queue object + * passed in is null. * ********************************************************************/ void* DCE2_QueueDequeue(DCE2_Queue* queue) @@ -808,7 +808,7 @@ void* DCE2_QueueDequeue(DCE2_Queue* queue) * * Removes all of the nodes in a queue. Does not delete the queue * object itself. Calls data free function for data if it is - * not NULL. + * not null. * * Arguments: * DCE2_Queue * @@ -876,7 +876,7 @@ void DCE2_QueueDestroy(DCE2_Queue* queue) * Returns: * void * * The data in the first node in the queue. - * NULL if the queue object passed in is NULL, or there are + * Null if the queue object passed in is null, or there are * no items in the queue. * ********************************************************************/ @@ -909,7 +909,7 @@ void* DCE2_QueueFirst(DCE2_Queue* queue) * Returns: * void * * The data in the next node in the queue. - * NULL if the queue object passed in is NULL, or we are at + * Null if the queue object passed in is null, or we are at * the end of the queue and there are no next nodes. * ********************************************************************/ @@ -994,7 +994,7 @@ void DCE2_QueueRemoveCurrent(DCE2_Queue* queue) * Returns: * void * * The data in the last node in the queue. - * NULL if the queue object passed in is NULL, or there are + * Null if the queue object passed in is null, or there are * no items in the queue. * ********************************************************************/ diff --git a/src/service_inspectors/dce_rpc/dce_list.h b/src/service_inspectors/dce_rpc/dce_list.h index da3e4546f..1ae594003 100644 --- a/src/service_inspectors/dce_rpc/dce_list.h +++ b/src/service_inspectors/dce_rpc/dce_list.h @@ -142,7 +142,7 @@ void* DCE2_QueueLast(DCE2_Queue*); * Returns: * bool * true if the list has zero nodes in it or the list object - * passed in is NULL. + * passed in is null. * false if the list has one or more nodes in it. * ********************************************************************/ diff --git a/src/service_inspectors/dce_rpc/dce_smb_commands.cc b/src/service_inspectors/dce_rpc/dce_smb_commands.cc index 94537a48f..d5272c075 100644 --- a/src/service_inspectors/dce_rpc/dce_smb_commands.cc +++ b/src/service_inspectors/dce_rpc/dce_smb_commands.cc @@ -1276,7 +1276,7 @@ DCE2_Ret DCE2_SmbSessionSetupAndX(DCE2_SmbSsnData* ssd, const SmbNtHdr* smb_hdr, return DCE2_RET__SUCCESS; } - // Move past NULL string terminator + // Move past null string terminator dce2_move(nb_ptr, nb_len, increment); } } @@ -1592,7 +1592,7 @@ DCE2_Ret DCE2_SmbNegotiate(DCE2_SmbSsnData* ssd, const SmbNtHdr*, if (nb_len == 0) break; - // Just a NULL byte - acceptable by Samba and Windows + // Just a null byte - acceptable by Samba and Windows if (term_ptr == nb_ptr) continue; @@ -1600,7 +1600,7 @@ DCE2_Ret DCE2_SmbNegotiate(DCE2_SmbSsnData* ssd, const SmbNtHdr*, && (strncmp((const char*)nb_ptr, SMB_DIALECT_NT_LM_012, term_ptr - nb_ptr) == 0)) break; - // Move past string and NULL byte + // Move past string and null byte dce2_move(nb_ptr, nb_len, (term_ptr - nb_ptr) + 1); ntlm_index++; @@ -1674,7 +1674,7 @@ DCE2_Ret DCE2_SmbTreeConnectAndX(DCE2_SmbSsnData* ssd, const SmbNtHdr* smb_hdr, while ((bs = (const uint8_t*)memchr(nb_ptr, '\\', nb_len)) != nullptr) dce2_move(nb_ptr, nb_len, (bs - nb_ptr) + 1); - // Move past NULL byte if unicode + // Move past null byte if unicode if (SmbUnicode(smb_hdr) && (nb_len != 0)) dce2_move(nb_ptr, nb_len, 1); diff --git a/src/service_inspectors/dce_rpc/dce_smb_module.cc b/src/service_inspectors/dce_rpc/dce_smb_module.cc index 842f49de9..53a6d99c5 100644 --- a/src/service_inspectors/dce_rpc/dce_smb_module.cc +++ b/src/service_inspectors/dce_rpc/dce_smb_module.cc @@ -519,7 +519,7 @@ bool Dce2SmbModule::set(const char*, Value& v, SnortConfig*) void Dce2SmbModule::get_data(dce2SmbProtoConf& dce2_smb_config) { - dce2_smb_config = config; // includes pointer copy so set to NULL + dce2_smb_config = config; // includes pointer copy so set to null config.smb_invalid_shares = nullptr; } diff --git a/src/service_inspectors/dce_rpc/dce_smb_transaction.cc b/src/service_inspectors/dce_rpc/dce_smb_transaction.cc index 427da039e..8f739782f 100644 --- a/src/service_inspectors/dce_rpc/dce_smb_transaction.cc +++ b/src/service_inspectors/dce_rpc/dce_smb_transaction.cc @@ -553,7 +553,7 @@ static DCE2_Ret DCE2_SmbUpdateTransRequest(DCE2_SmbSsnData* ssd, // Not implemented according to MS-CIFS case TRANS_RAW_READ_NMPIPE: - // Can only write 2 NULL bytes and subsequent writes return pipe disconnected + // Can only write 2 null bytes and subsequent writes return pipe disconnected case TRANS_RAW_WRITE_NMPIPE: // Can at most do a DCE/RPC bind diff --git a/src/service_inspectors/dce_rpc/dce_smb_utils.cc b/src/service_inspectors/dce_rpc/dce_smb_utils.cc index a5fab9775..a0fa0cd2d 100644 --- a/src/service_inspectors/dce_rpc/dce_smb_utils.cc +++ b/src/service_inspectors/dce_rpc/dce_smb_utils.cc @@ -663,7 +663,7 @@ void DCE2_SmbRemoveFileTrackerFromRequestTrackers(DCE2_SmbSsnData* ssd, if (ftracker == nullptr) return; - // NULL out file trackers of any outstanding requests + // null out file trackers of any outstanding requests // that reference this file tracker if (ssd->rtracker.ftracker == ftracker) ssd->rtracker.ftracker = nullptr; @@ -1168,7 +1168,7 @@ Packet* DCE2_SmbGetRpkt(DCE2_SmbSsnData* ssd, * * Arguments: * DCE2_SmbBuffer ** - * Pointer to pointer of buffer to add data to. If NULL + * Pointer to pointer of buffer to add data to. If null * a new buffer will be allocated. * uint8_t * * Pointer to the current data cursor in packet. diff --git a/src/service_inspectors/dce_rpc/dce_utils.h b/src/service_inspectors/dce_rpc/dce_utils.h index 2379297da..de6168737 100644 --- a/src/service_inspectors/dce_rpc/dce_utils.h +++ b/src/service_inspectors/dce_rpc/dce_utils.h @@ -193,7 +193,7 @@ inline bool DCE2_IsConfigEndChar(const char c) * * Arguments: * char * - * NULL terminated string to prune. + * null terminated string to prune. * int * length of string * @@ -202,7 +202,7 @@ inline bool DCE2_IsConfigEndChar(const char c) * still points within the original string. * * Side effects: Spaces at the end of the string passed in as an - * argument are replaced by NULL bytes. + * argument are replaced by null bytes. * ********************************************************************/ inline char* DCE2_PruneWhiteSpace(char* str) @@ -212,7 +212,7 @@ inline char* DCE2_PruneWhiteSpace(char* str) if (str == nullptr) return nullptr; - /* Put end a char before NULL byte */ + /* Put end a char before null byte */ end = str + (strlen(str) - 1); while (isspace((int)*str)) @@ -230,14 +230,14 @@ inline char* DCE2_PruneWhiteSpace(char* str) /******************************************************************** * Function: DCE2_IsEmptyStr() * - * Checks if string is NULL, empty or just spaces. + * Checks if string is null, empty or just spaces. * String must be 0 terminated. * * Arguments: None * char * - string to check * * Returns: - * true if string is NULL, empty or just spaces + * true if string is null, empty or just spaces * false otherwise * ********************************************************************/ diff --git a/src/service_inspectors/dce_rpc/ips_dce_opnum.cc b/src/service_inspectors/dce_rpc/ips_dce_opnum.cc index 7fb9941e1..199eca98b 100644 --- a/src/service_inspectors/dce_rpc/ips_dce_opnum.cc +++ b/src/service_inspectors/dce_rpc/ips_dce_opnum.cc @@ -298,7 +298,7 @@ static DCE2_Ret DCE2_OpnumParse(char* args, DCE2_Opnum* opnum) uint16_t num_opnums = 0; unsigned int i; - /* Include NULL byte for parsing */ + /* Include null byte for parsing */ args_end = args + (strlen(args) + 1); memset(opnum_mask, 0, sizeof(opnum_mask)); diff --git a/src/service_inspectors/dce_rpc/smb_common.h b/src/service_inspectors/dce_rpc/smb_common.h index 934ba9d79..aa615caf7 100644 --- a/src/service_inspectors/dce_rpc/smb_common.h +++ b/src/service_inspectors/dce_rpc/smb_common.h @@ -443,8 +443,8 @@ inline uint16_t SmbAndXOff2(const SmbAndXCommon* andx) } /* SMB formats (smb_fmt) Dialect, Pathname and ASCII are all - * NULL terminated ASCII strings unless Unicode is specified - * in the NT LM 1.0 SMB header in which case they are NULL + * null terminated ASCII strings unless Unicode is specified + * in the NT LM 1.0 SMB header in which case they are null * terminated unicode strings */ #define SMB_FMT__DATA_BLOCK 1 diff --git a/src/service_inspectors/dce_rpc/smb_message.cc b/src/service_inspectors/dce_rpc/smb_message.cc index 31246362e..0fbfda866 100644 --- a/src/service_inspectors/dce_rpc/smb_message.cc +++ b/src/service_inspectors/dce_rpc/smb_message.cc @@ -732,7 +732,7 @@ static void DCE2_SmbCheckCommand(DCE2_SmbSsnData* ssd, && (DCE2_SsnGetPolicy(&ssd->sd) == DCE2_POLICY__SAMBA)) { // Current Samba errors on a zero byte count Transaction because it - // uses it to get the Name string and if zero Name will be NULL and + // uses it to get the Name string and if zero Name will be null and // it won't process it. com_info.cmd_error |= DCE2_SMB_COM_ERROR__BAD_LENGTH; } diff --git a/src/service_inspectors/dns/dns.cc b/src/service_inspectors/dns/dns.cc index 7f26dce55..5e43a8f66 100644 --- a/src/service_inspectors/dns/dns.cc +++ b/src/service_inspectors/dns/dns.cc @@ -596,7 +596,7 @@ static uint16_t CheckRRTypeTXTVuln( dnsSessionData->curr_txt.txt_len = (uint8_t)*data; dnsSessionData->curr_txt.txt_count++; - /* include the NULL */ + /* include the null */ dnsSessionData->curr_txt.total_txt_len += dnsSessionData->curr_txt.txt_len + 1; if (!dnsSessionData->curr_txt.alerted) diff --git a/src/service_inspectors/ftp_telnet/ftp_cmd_lookup.cc b/src/service_inspectors/ftp_telnet/ftp_cmd_lookup.cc index 1c4199363..eaa939a96 100644 --- a/src/service_inspectors/ftp_telnet/ftp_cmd_lookup.cc +++ b/src/service_inspectors/ftp_telnet/ftp_cmd_lookup.cc @@ -111,7 +111,7 @@ int ftp_cmd_lookup_add(CMD_LOOKUP* CmdLookup, const char* cmd, int len, * Returns: int => return code indicating error or success * * Returns: FTP_CMD_CONF* => Pointer to cmd configuration structure - * matching IP if found, NULL otherwise. + * matching IP if found, null otherwise. * */ FTP_CMD_CONF* ftp_cmd_lookup_find(CMD_LOOKUP* CmdLookup, diff --git a/src/service_inspectors/ftp_telnet/pp_telnet.cc b/src/service_inspectors/ftp_telnet/pp_telnet.cc index 791959793..3ae2dc3df 100644 --- a/src/service_inspectors/ftp_telnet/pp_telnet.cc +++ b/src/service_inspectors/ftp_telnet/pp_telnet.cc @@ -227,7 +227,7 @@ int normalize_telnet( /* wind it back a line? */ if (ignoreEraseCmds == FTPP_APPLY_TNC_ERASE_CMDS) { - /* Go back to previous CR NULL or CR LF? */ + /* Go back to previous CR null or CR LF? */ while (write_ptr > start) { /* Go to previous char */ @@ -333,7 +333,7 @@ int normalize_telnet( { read_ptr++; if (*read_ptr != 0x00) - /* Encryption type is not NULL */ + /* Encryption type is not null */ { /* printf("Encryption being negotiated by * telnet client\n"); */ diff --git a/src/service_inspectors/sip/sip_config.cc b/src/service_inspectors/sip/sip_config.cc index 1620b6de1..e49afab4b 100644 --- a/src/service_inspectors/sip/sip_config.cc +++ b/src/service_inspectors/sip/sip_config.cc @@ -106,7 +106,7 @@ void SIP_SetDefaultMethods(SIP_PROTO_CONF* config) * after parsing the methods list. * SIPMethods* * Flag for the methods. - * NULL flag if not a valid method type + * Null flag if not a valid method type * Returns: * ********************************************************************/ diff --git a/src/service_inspectors/sip/sip_parser.h b/src/service_inspectors/sip/sip_parser.h index 49ffa3a8c..5b341bec4 100644 --- a/src/service_inspectors/sip/sip_parser.h +++ b/src/service_inspectors/sip/sip_parser.h @@ -56,7 +56,7 @@ struct SIPMsg SIP_MediaSession* mediaSession; const char* authorization; const uint8_t* header; - const uint8_t* body_data; // Set to NULL if not applicable + const uint8_t* body_data; // Set to null if not applicable uint64_t cseqnum; uint16_t userNameLen; diff --git a/src/service_inspectors/sip/sip_roptions.h b/src/service_inspectors/sip/sip_roptions.h index f8d7463ac..3d4ca681e 100644 --- a/src/service_inspectors/sip/sip_roptions.h +++ b/src/service_inspectors/sip/sip_roptions.h @@ -35,10 +35,10 @@ struct SIP_Roptions uint16_t status_code; // sip_stat_code data - const uint8_t* header_data; // Set to NULL if not applicable + const uint8_t* header_data; // Set to null if not applicable uint16_t header_len; - const uint8_t* body_data; // Set to NULL if not applicable + const uint8_t* body_data; // Set to null if not applicable uint16_t body_len; }; diff --git a/src/service_inspectors/sip/sip_utils.cc b/src/service_inspectors/sip/sip_utils.cc index cf058ee4e..0ea248108 100644 --- a/src/service_inspectors/sip/sip_utils.cc +++ b/src/service_inspectors/sip/sip_utils.cc @@ -84,7 +84,7 @@ int SIP_TrimSP(const char* start, const char* end, const char** new_start, const * int - length of the method name * * Returns: - * SIPMethodNode*- the founded method node, or NULL if not founded + * SIPMethodNode*- the founded method node, or null if not founded * ********************************************************************/ @@ -113,7 +113,7 @@ SIPMethodNode* SIP_FindMethod(SIPMethodlist methods, const char* methodName, uns * int: length of the string * * Returns: - * 1 if string is NULL, empty or just spaces + * 1 if string is null, empty or just spaces * 0 otherwise * ********************************************************************/ diff --git a/src/service_inspectors/smtp/smtp.cc b/src/service_inspectors/smtp/smtp.cc index 80f421b02..8f1053ff5 100644 --- a/src/service_inspectors/smtp/smtp.cc +++ b/src/service_inspectors/smtp/smtp.cc @@ -333,7 +333,7 @@ static int AddCmd(SmtpProtoConf* config, const char* name, SMTPCmdTypeEnum type) config->num_cmds++; - /* allocate enough memory for new command - alloc one extra for NULL entry */ + /* allocate enough memory for new command - alloc one extra for null entry */ // FIXIT-L this constant reallocation is not necessary; use vector cmds = (SMTPToken*)snort_calloc((config->num_cmds + 1) * sizeof(*cmds)); cmd_config = (SMTPCmdConfig*)snort_calloc((config->num_cmds + 1) * sizeof(*cmd_config)); diff --git a/src/sfip/sf_ip.cc b/src/sfip/sf_ip.cc index 97997805e..43ce58c42 100644 --- a/src/sfip/sf_ip.cc +++ b/src/sfip/sf_ip.cc @@ -226,7 +226,7 @@ SfIpRet SfIp::set(const char* src, uint16_t* srcBits) /* check for and extract a mask in CIDR form */ if ( (mask = strchr(ip, (int)'/')) != nullptr ) { - /* NULL out this character so inet_pton will see the + /* Null out this character so inet_pton will see the * correct ending to the IP string */ char* end = mask++; while ( (end > ip) && isspace((int)end[-1]) ) diff --git a/src/sfip/sf_ipvar.cc b/src/sfip/sf_ipvar.cc index c52b7fbb9..6e3794d7a 100644 --- a/src/sfip/sf_ipvar.cc +++ b/src/sfip/sf_ipvar.cc @@ -309,7 +309,7 @@ static sfip_node_t* merge_lists(sfip_node_t* list1, sfip_node_t* list2, uint16_t return list1; } - /*Both lists are sorted and not NULL. If list1 or list2 contains "any", free the other list*/ + /*Both lists are sorted and not null. If list1 or list2 contains "any", free the other list*/ if (list1->flags & SFIP_ANY) { merge_len = list1_len; @@ -324,7 +324,7 @@ static sfip_node_t* merge_lists(sfip_node_t* list1, sfip_node_t* list2, uint16_t return list2; } - /*Iterate till one of the list is NULL. Append each node to merge_list*/ + /*Iterate till one of the list is null. Append each node to merge_list*/ while (list1 && list2) { if ( num_nodes ) @@ -388,7 +388,7 @@ static sfip_node_t* merge_lists(sfip_node_t* list1, sfip_node_t* list2, uint16_t num_nodes++; } - /*list2 is NULL. Append list1*/ + /*list2 is null. Append list1*/ while ( list1 ) { tmp = list1->next; @@ -401,7 +401,7 @@ static sfip_node_t* merge_lists(sfip_node_t* list1, sfip_node_t* list2, uint16_t list1 = tmp; } - /*list1 is NULL. Append list2*/ + /*list1 is null. Append list2*/ while ( list2 ) { tmp = list2->next; @@ -600,11 +600,11 @@ static SfIpRet sfvar_list_compare(sfip_node_t* list1, sfip_node_t* list2) /* Check's if two variables have the same nodes */ SfIpRet sfvar_compare(const sfip_var_t* one, const sfip_var_t* two) { - /* If both NULL, consider equal */ + /* If both null, consider equal */ if (!one && !two) return SFIP_EQUAL; - /* If one NULL and not the other, consider unequal */ + /* If one null and not the other, consider unequal */ if ((one && !two) || (!one && two)) return SFIP_FAILURE; diff --git a/src/sfrt/sfrt.cc b/src/sfrt/sfrt.cc index 7345ab2b4..a419f80ac 100644 --- a/src/sfrt/sfrt.cc +++ b/src/sfrt/sfrt.cc @@ -324,7 +324,7 @@ void sfrt_cleanup(table_t* table, sfrt_iterator_callback cleanup_func) cleanup_func(table->data[index]); /* cleanup_func is supposed to free memory associated with this - * table->data[index]. Set that to NULL. + * table->data[index]. Set that to null. */ table->data[index] = nullptr; diff --git a/src/sfrt/sfrt_dir.cc b/src/sfrt/sfrt_dir.cc index 8cdf72110..5da789d77 100644 --- a/src/sfrt/sfrt_dir.cc +++ b/src/sfrt/sfrt_dir.cc @@ -415,7 +415,7 @@ static int _dir_sub_insert(IPLOOKUP* ip, int length, int cur_len, GENERIC ptr, (dir_sub_table_t*)sub_table->entries[index]; /* Check if we need to alloc a new sub table. - * If next_sub was 0/NULL, there's no entry at this index + * If next_sub was 0/null, there's no entry at this index * If the length is non-zero, there is an entry */ if (!next_sub || sub_table->lengths[index]) { diff --git a/src/sfrt/sfrt_flat.cc b/src/sfrt/sfrt_flat.cc index 2894cfb93..3fcb72534 100644 --- a/src/sfrt/sfrt_flat.cc +++ b/src/sfrt/sfrt_flat.cc @@ -49,7 +49,7 @@ table_flat_t* sfrt_flat_new(char table_flat_type, char ip_type, long data_size, /*The first allocation always return 0*/ if (!table_ptr) { - // return NULL; + // return nullptr; } #endif diff --git a/src/sfrt/sfrt_flat_dir.cc b/src/sfrt/sfrt_flat_dir.cc index 3fcc65289..9d72125e7 100644 --- a/src/sfrt/sfrt_flat_dir.cc +++ b/src/sfrt/sfrt_flat_dir.cc @@ -434,7 +434,7 @@ static int _dir_sub_insert(IPLOOKUP* ip, int length, int cur_len, INFO ptr, DIR_Entry* entry = (DIR_Entry*)(&base[sub_table->entries]); /* Check if we need to alloc a new sub table. - * If next_sub was 0/NULL, there's no entry at this index + * If next_sub was 0/null, there's no entry at this index * If the length is non-zero, there is an entry */ if (!entry[index].value || entry[index].length) { diff --git a/src/stream/stream.cc b/src/stream/stream.cc index 72891fa87..e632a1fbf 100644 --- a/src/stream/stream.cc +++ b/src/stream/stream.cc @@ -245,24 +245,6 @@ int Stream::ignore_flow( ctrlPkt, type, ip_proto, srcIP, srcPort, dstIP, dstPort, direction, fd); } -void Stream::proxy_started(Flow* flow, unsigned dir) -{ - if (!flow) - return; - - TcpSession* tcpssn = (TcpSession*)flow->session; - tcpssn->flush(); - - if ( dir & SSN_DIR_FROM_SERVER ) - set_splitter(flow, true, new LogSplitter(true)); - - if ( dir & SSN_DIR_FROM_CLIENT ) - set_splitter(flow, false, new LogSplitter(false)); - - tcpssn->start_proxy(); - flow->set_proxied(); -} - void Stream::stop_inspection( Flow* flow, Packet* p, char dir, int32_t /*bytes*/, int /*response*/) @@ -298,24 +280,6 @@ void Stream::stop_inspection( flow->set_state(Flow::FlowState::ALLOW); } -void Stream::resume_inspection(Flow* flow, char dir) -{ - if (!flow) - return; - - switch (dir) - { - case SSN_DIR_BOTH: - case SSN_DIR_FROM_CLIENT: - case SSN_DIR_FROM_SERVER: - if (flow->ssn_state.ignore_direction & dir) - { - flow->ssn_state.ignore_direction &= ~dir; - } - break; - } -} - uint32_t Stream::get_packet_direction(Packet* p) { if (!p || !(p->flow)) diff --git a/src/stream/stream.h b/src/stream/stream.h index 021cfa11b..ab4bfbfa5 100644 --- a/src/stream/stream.h +++ b/src/stream/stream.h @@ -101,9 +101,6 @@ public: // packet_flags field of the Packet struct to indicate the direction determined. static uint32_t get_packet_direction(Packet*); - // Sets the stream session into proxy mode. - static void proxy_started(Flow*, unsigned dir); // FIXIT-L method name is misleading - // Stop inspection on a flow for up to count bytes (-1 to ignore for life or until resume). // If response flag is set, automatically resume inspection up to count bytes when a data // packet in the other direction is seen. Also marks the packet to be ignored @@ -117,10 +114,6 @@ public: const Packet* ctrlPkt, PktType, IpProtocol, const snort::SfIp* srcIP, uint16_t srcPort, const snort::SfIp* dstIP, uint16_t dstPort, char direction, FlowData* fd); - // Resume inspection for flow. - // FIXIT-L does resume work only for a flow that has been stopped by call to stop_inspection? - static void resume_inspection(Flow*, char dir); - // Set Active status to force drop the current packet and set flow state to drop // subsequent packets arriving from the direction specified. static void drop_traffic(const Packet*, char dir); diff --git a/src/stream/tcp/segment_overlap_editor.cc b/src/stream/tcp/segment_overlap_editor.cc index c97f5de7f..c6a61ee56 100644 --- a/src/stream/tcp/segment_overlap_editor.cc +++ b/src/stream/tcp/segment_overlap_editor.cc @@ -377,7 +377,7 @@ void SegmentOverlapEditor::full_right_overlap_truncate_new(TcpReassemblerState& // Set seq to end of right since overlap was greater than or equal to right->size and // inserted seq has been truncated to beginning of right and reset trunc length to 0 - // since we may fall out of loop if next right is NULL + // since we may fall out of loop if next right is null trs.sos.seq = trs.sos.right->i_seq + trs.sos.right->i_len; trs.sos.left = trs.sos.right; trs.sos.right = trs.sos.right->next; diff --git a/src/stream/tcp/test/tcp_normalizer_test.cc b/src/stream/tcp/test/tcp_normalizer_test.cc index 0f5c76dd4..7747d6c28 100644 --- a/src/stream/tcp/test/tcp_normalizer_test.cc +++ b/src/stream/tcp/test/tcp_normalizer_test.cc @@ -107,7 +107,7 @@ TEST_GROUP(tcp_normalizers) TEST(tcp_normalizers, os_policy) { StreamPolicy os_policy; - Flow* flow = new FlowMock; + Flow* flow = new Flow; TcpSession* session = new TcpSessionMock( flow ); TcpNormalizerState tns; @@ -126,7 +126,7 @@ TEST(tcp_normalizers, os_policy) TEST(tcp_normalizers, paws_fudge_config) { StreamPolicy os_policy; - Flow* flow = new FlowMock; + Flow* flow = new Flow; TcpSession* session = new TcpSessionMock( flow ); TcpNormalizerState tns; @@ -154,7 +154,7 @@ TEST(tcp_normalizers, paws_fudge_config) TEST(tcp_normalizers, paws_drop_zero_ts_config) { StreamPolicy os_policy; - Flow* flow = new FlowMock; + Flow* flow = new Flow; TcpSession* session = new TcpSessionMock( flow ); TcpNormalizerState tns; @@ -186,7 +186,7 @@ TEST(tcp_normalizers, paws_drop_zero_ts_config) TEST(tcp_normalizers, norm_options_enabled) { StreamPolicy os_policy; - Flow* flow = new FlowMock; + Flow* flow = new Flow; TcpSession* session = new TcpSessionMock( flow ); norm_enabled = true; diff --git a/src/utils/util_cstring.cc b/src/utils/util_cstring.cc index fc44b770c..74853d0af 100644 --- a/src/utils/util_cstring.cc +++ b/src/utils/util_cstring.cc @@ -187,7 +187,7 @@ int SnortStrnlen(const char* buf, int buf_size) /* * Find first occurrence of char of accept in s, limited by slen. * A 'safe' version of strpbrk that won't read past end of buffer s - * in cases that s is not NULL terminated. + * in cases that s is not null terminated. * * This code assumes 'accept' is a static string. */ @@ -212,7 +212,7 @@ const char* SnortStrnPbrk(const char* s, int slen, const char* accept) /* * Find first occurrence of searchstr in s, limited by slen. * A 'safe' version of strstr that won't read past end of buffer s - * in cases that s is not NULL terminated. + * in cases that s is not null terminated. */ const char* SnortStrnStr(const char* s, int slen, const char* searchstr) {