From 775ec6795e7d078fff37a882740523f455dfdaeb Mon Sep 17 00:00:00 2001 From: Jon Siwek Date: Fri, 27 Sep 2013 10:13:52 -0500 Subject: [PATCH] Fix uninitialized (or unused) fields. --- src/Anon.cc | 2 + src/Attr.h | 2 +- src/BPF_Program.cc | 3 +- src/ChunkedIO.cc | 4 +- src/ChunkedIO.h | 5 ++- src/CompHash.cc | 1 + src/Conn.cc | 1 + src/DFA.cc | 1 + src/DNS_Mgr.cc | 12 +++++- src/DbgBreakpoint.cc | 2 + src/Debug.cc | 1 + src/Dict.cc | 4 ++ src/Expr.cc | 11 +++++- src/Expr.h | 5 +-- src/File.h | 1 - src/FlowSrc.cc | 1 - src/FlowSrc.h | 3 -- src/RemoteSerializer.cc | 4 ++ src/Rule.h | 1 + src/RuleMatcher.h | 2 +- src/SerialInfo.h | 1 + src/SerializationFormat.cc | 3 +- src/Serializer.cc | 1 + src/Serializer.h | 1 + src/Sessions.h | 7 +--- src/SmithWaterman.cc | 2 +- src/SmithWaterman.h | 4 +- src/Stats.cc | 1 + src/Stats.h | 12 +----- src/Type.cc | 4 +- src/Val.cc | 1 + src/Val.h | 2 +- src/analyzer/Analyzer.cc | 3 +- src/analyzer/protocol/conn-size/ConnSize.cc | 3 +- src/analyzer/protocol/dns/DNS.cc | 3 +- src/analyzer/protocol/dns/DNS.h | 1 - src/analyzer/protocol/http/HTTP.cc | 1 + src/analyzer/protocol/icmp/ICMP.cc | 5 +-- src/analyzer/protocol/login/Login.cc | 2 +- src/analyzer/protocol/login/NVT.cc | 11 ++---- src/analyzer/protocol/login/RSH.cc | 3 ++ src/analyzer/protocol/mime/MIME.cc | 5 ++- src/analyzer/protocol/mime/MIME.h | 1 - src/analyzer/protocol/netbios/NetbiosSSN.cc | 2 +- src/analyzer/protocol/pia/PIA.cc | 3 +- src/analyzer/protocol/pop3/POP3.cc | 3 ++ src/analyzer/protocol/rpc/RPC.cc | 5 +-- src/analyzer/protocol/smb/SMB.cc | 3 ++ src/analyzer/protocol/tcp/TCP.cc | 3 +- src/analyzer/protocol/tcp/TCP_Endpoint.cc | 3 ++ src/bif_arg.cc | 1 + .../analyzer/unified2/Unified2.h | 1 - src/input/Manager.cc | 37 ++++++++----------- src/input/ReaderBackend.cc | 2 + src/input/readers/Ascii.cc | 3 +- src/input/readers/Benchmark.cc | 2 + src/input/readers/Raw.cc | 3 ++ src/input/readers/SQLite.cc | 4 +- src/logging/WriterFrontend.cc | 3 ++ src/logging/writers/DataSeries.cc | 4 ++ src/logging/writers/SQLite.cc | 6 +-- src/threading/SerialTypes.h | 2 +- 62 files changed, 135 insertions(+), 98 deletions(-) diff --git a/src/Anon.cc b/src/Anon.cc index f58057b2fc..87791501a4 100644 --- a/src/Anon.cc +++ b/src/Anon.cc @@ -147,7 +147,9 @@ void AnonymizeIPAddr_A50::init() special_nodes[0].input = special_nodes[0].output = 0; special_nodes[1].input = special_nodes[1].output = 0xFFFFFFFF; + method = 0; before_anonymization = 1; + new_mapping = 0; } int AnonymizeIPAddr_A50::PreservePrefix(ipaddr32_t input, int num_bits) diff --git a/src/Attr.h b/src/Attr.h index c3e05d4762..7becbb27eb 100644 --- a/src/Attr.h +++ b/src/Attr.h @@ -96,7 +96,7 @@ public: bool operator==(const Attributes& other) const; protected: - Attributes() { type = 0; attrs = 0; } + Attributes() : type(), attrs(), in_record() { } void CheckAttr(Attr* attr); DECLARE_SERIAL(Attributes); diff --git a/src/BPF_Program.cc b/src/BPF_Program.cc index a6d3d80c05..5260429eb0 100644 --- a/src/BPF_Program.cc +++ b/src/BPF_Program.cc @@ -58,9 +58,8 @@ int pcap_compile_nopcap(int snaplen_arg, int linktype_arg, } #endif -BPF_Program::BPF_Program() +BPF_Program::BPF_Program() : m_compiled(), m_program() { - m_compiled = false; } BPF_Program::~BPF_Program() diff --git a/src/ChunkedIO.cc b/src/ChunkedIO.cc index 7e666ee198..22489bbb0c 100644 --- a/src/ChunkedIO.cc +++ b/src/ChunkedIO.cc @@ -14,9 +14,8 @@ #include "NetVar.h" #include "RemoteSerializer.h" -ChunkedIO::ChunkedIO() +ChunkedIO::ChunkedIO() : stats(), tag(), pure() { - pure = false; } void ChunkedIO::Stats(char* buffer, int length) @@ -656,6 +655,7 @@ SSL_CTX* ChunkedIOSSL::ctx; ChunkedIOSSL::ChunkedIOSSL(int arg_socket, bool arg_server) { socket = arg_socket; + last_ret = 0; eof = false; setup = false; server = arg_server; diff --git a/src/ChunkedIO.h b/src/ChunkedIO.h index 56b5656945..6ee79cd3c4 100644 --- a/src/ChunkedIO.h +++ b/src/ChunkedIO.h @@ -292,8 +292,9 @@ private: // Wrapper class around a another ChunkedIO which the (un-)compresses data. class CompressedChunkedIO : public ChunkedIO { public: - CompressedChunkedIO(ChunkedIO* arg_io) - : io(arg_io) {} // takes ownership + CompressedChunkedIO(ChunkedIO* arg_io) // takes ownership + : io(arg_io), zin(), zout(), error(), compress(), uncompress(), + uncompressed_bytes_read(), uncompressed_bytes_written() {} virtual ~CompressedChunkedIO() { delete io; } virtual bool Init(); // does *not* call arg_io->Init() diff --git a/src/CompHash.cc b/src/CompHash.cc index b2eb08c589..5a972f6016 100644 --- a/src/CompHash.cc +++ b/src/CompHash.cc @@ -11,6 +11,7 @@ CompositeHash::CompositeHash(TypeList* composite_type) { type = composite_type; Ref(type); + singleton_tag = TYPE_INTERNAL_ERROR; // If the only element is a record, don't treat it as a // singleton, since it needs to be evaluated specially. diff --git a/src/Conn.cc b/src/Conn.cc index 2e5aa0513e..e221bb20e0 100644 --- a/src/Conn.cc +++ b/src/Conn.cc @@ -141,6 +141,7 @@ Connection::Connection(NetSessions* s, HashKey* k, double t, const ConnID* id, suppress_event = 0; record_contents = record_packets = 1; + record_current_packet = record_current_content = 0; timers_canceled = 0; inactivity_timeout = 0; diff --git a/src/DFA.cc b/src/DFA.cc index 3bdc444f9e..ad9521709e 100644 --- a/src/DFA.cc +++ b/src/DFA.cc @@ -20,6 +20,7 @@ DFA_State::DFA_State(int arg_state_num, const EquivClass* ec, nfa_states = arg_nfa_states; accept = arg_accept; mark = 0; + centry = 0; SymPartition(ec); diff --git a/src/DNS_Mgr.cc b/src/DNS_Mgr.cc index 08e8889a10..c1036accdd 100644 --- a/src/DNS_Mgr.cc +++ b/src/DNS_Mgr.cc @@ -47,8 +47,14 @@ extern int select(int, fd_set *, fd_set *, fd_set *, struct timeval *); class DNS_Mgr_Request { public: DNS_Mgr_Request(const char* h, int af, bool is_txt) - { host = copy_string(h); fam = af; qtype = is_txt ? 16 : 0; } - DNS_Mgr_Request(const IPAddr& a) { addr = a; host = 0; fam = 0; } + : host(copy_string(h)), fam(af), qtype(is_txt ? 16 : 0), addr(), + request_pending() + { } + + DNS_Mgr_Request(const IPAddr& a) + : host(), fam(), qtype(), addr(a), request_pending() + { } + ~DNS_Mgr_Request() { delete [] host; } // Returns nil if this was an address request. @@ -192,6 +198,8 @@ DNS_Mapping::DNS_Mapping(FILE* f) init_failed = 1; req_host = 0; + req_ttl = 0; + creation_time = 0; char buf[512]; diff --git a/src/DbgBreakpoint.cc b/src/DbgBreakpoint.cc index f1ad551a00..9000d89077 100644 --- a/src/DbgBreakpoint.cc +++ b/src/DbgBreakpoint.cc @@ -49,6 +49,8 @@ DbgBreakpoint::DbgBreakpoint() repeat_count = hit_count = 0; description[0] = 0; + source_filename = 0; + source_line = 0; } DbgBreakpoint::~DbgBreakpoint() diff --git a/src/Debug.cc b/src/Debug.cc index d3cf042ccc..f4ac8c2fdf 100644 --- a/src/Debug.cc +++ b/src/Debug.cc @@ -40,6 +40,7 @@ DebuggerState::DebuggerState() next_bp_id = next_watch_id = next_display_id = 1; BreakBeforeNextStmt(false); curr_frame_idx = 0; + already_did_list = false; BreakFromSignal(false); // ### Don't choose this arbitrary size! Extend Frame. diff --git a/src/Dict.cc b/src/Dict.cc index c71cf4c417..cd7792b539 100644 --- a/src/Dict.cc +++ b/src/Dict.cc @@ -64,6 +64,10 @@ Dictionary::Dictionary(dict_order ordering, int initial_size) SetDensityThresh(DEFAULT_DENSITY_THRESH); delete_func = 0; + tbl_next_ind = 0; + + num_buckets2 = num_entries2 = max_num_entries2 = thresh_entries2 = 0; + den_thresh2 = 0; } Dictionary::~Dictionary() diff --git a/src/Expr.cc b/src/Expr.cc index 2bd06054d6..a8aab865ca 100644 --- a/src/Expr.cc +++ b/src/Expr.cc @@ -2472,6 +2472,7 @@ AssignExpr::AssignExpr(Expr* arg_op1, Expr* arg_op2, int arg_is_init, : BinaryExpr(EXPR_ASSIGN, arg_is_init ? arg_op1 : arg_op1->MakeLvalue(), arg_op2) { + val = 0; is_init = arg_is_init; if ( IsError() ) @@ -3345,14 +3346,14 @@ bool HasFieldExpr::DoSerialize(SerialInfo* info) const { DO_SERIALIZE(SER_HAS_FIELD_EXPR, UnaryExpr); - // Serialize the former "bool is_attr" first for backwards compatibility. + // Serialize former "bool is_attr" member first for backwards compatibility. return SERIALIZE(false) && SERIALIZE(field_name) && SERIALIZE(field); } bool HasFieldExpr::DoUnserialize(UnserialInfo* info) { DO_UNSERIALIZE(UnaryExpr); - // Unserialize the former "bool is_attr" first for backwards compatibility. + // Unserialize former "bool is_attr" member for backwards compatibility. bool not_used; return UNSERIALIZE(¬_used) && UNSERIALIZE_STR(&field_name, 0) && UNSERIALIZE(&field); } @@ -3361,6 +3362,8 @@ RecordConstructorExpr::RecordConstructorExpr(ListExpr* constructor_list, BroType* arg_type) : UnaryExpr(EXPR_RECORD_CONSTRUCTOR, constructor_list) { + ctor_type = 0; + if ( IsError() ) return; @@ -3501,6 +3504,8 @@ TableConstructorExpr::TableConstructorExpr(ListExpr* constructor_list, attr_list* arg_attrs, BroType* arg_type) : UnaryExpr(EXPR_TABLE_CONSTRUCTOR, constructor_list) { + attrs = 0; + if ( IsError() ) return; @@ -3625,6 +3630,8 @@ SetConstructorExpr::SetConstructorExpr(ListExpr* constructor_list, attr_list* arg_attrs, BroType* arg_type) : UnaryExpr(EXPR_SET_CONSTRUCTOR, constructor_list) { + attrs = 0; + if ( IsError() ) return; diff --git a/src/Expr.h b/src/Expr.h index ba173feae0..26f20fcbe9 100644 --- a/src/Expr.h +++ b/src/Expr.h @@ -331,12 +331,10 @@ protected: BinaryExpr() { op1 = op2 = 0; } BinaryExpr(BroExprTag arg_tag, Expr* arg_op1, Expr* arg_op2) - : Expr(arg_tag) + : Expr(arg_tag), op1(arg_op1), op2(arg_op2) { if ( ! (arg_op1 && arg_op2) ) return; - op1 = arg_op1; - op2 = arg_op2; if ( op1->IsError() || op2->IsError() ) SetError(); } @@ -749,7 +747,6 @@ protected: DECLARE_SERIAL(HasFieldExpr); - bool is_attr; const char* field_name; int field; }; diff --git a/src/File.h b/src/File.h index a37b7fe0a6..dc56c5a3fe 100644 --- a/src/File.h +++ b/src/File.h @@ -147,7 +147,6 @@ protected: Timer* rotate_timer; double open_time; - bool dont_rotate; // See InstallRotateTimer() bool print_hook; bool raw_output; diff --git a/src/FlowSrc.cc b/src/FlowSrc.cc index f5fb0bd1e6..7a79e9063b 100644 --- a/src/FlowSrc.cc +++ b/src/FlowSrc.cc @@ -64,7 +64,6 @@ void FlowSrc::Close() FlowSocketSrc::~FlowSocketSrc() { - delete [] listenparms; } int FlowSocketSrc::ExtractNextPDU() diff --git a/src/FlowSrc.h b/src/FlowSrc.h index 7b0b14ad15..03dda2761d 100644 --- a/src/FlowSrc.h +++ b/src/FlowSrc.h @@ -67,9 +67,6 @@ public: virtual ~FlowSocketSrc(); int ExtractNextPDU(); - -protected: - char* listenparms; }; class FlowFileSrc : public FlowSrc { diff --git a/src/RemoteSerializer.cc b/src/RemoteSerializer.cc index e36686b487..43a963ab21 100644 --- a/src/RemoteSerializer.cc +++ b/src/RemoteSerializer.cc @@ -541,6 +541,10 @@ RemoteSerializer::RemoteSerializer() in_sync = 0; last_flush = 0; received_logs = 0; + current_id = 0; + current_msgtype = 0; + current_args = 0; + source_peer = 0; } RemoteSerializer::~RemoteSerializer() diff --git a/src/Rule.h b/src/Rule.h index 959008fbf9..e5ae703d39 100644 --- a/src/Rule.h +++ b/src/Rule.h @@ -28,6 +28,7 @@ public: idx = rule_counter++; location = arg_location; active = true; + next = 0; } ~Rule(); diff --git a/src/RuleMatcher.h b/src/RuleMatcher.h index 351c3c30bf..0d7a2fbf7c 100644 --- a/src/RuleMatcher.h +++ b/src/RuleMatcher.h @@ -103,7 +103,7 @@ private: friend class RuleMatcher; struct PatternSet { - PatternSet() {} + PatternSet() : re() {} // If we're above the 'RE_level' (see RuleMatcher), this // expr contains all patterns on this node. If we're on diff --git a/src/SerialInfo.h b/src/SerialInfo.h index aa4c382349..de2d9eeb61 100644 --- a/src/SerialInfo.h +++ b/src/SerialInfo.h @@ -20,6 +20,7 @@ public: SerialInfo(const SerialInfo& info) { + chunk = info.chunk; s = info.s; may_suspend = info.may_suspend; cache = info.cache; diff --git a/src/SerializationFormat.cc b/src/SerializationFormat.cc index 10dd4f29ea..eb8462521e 100644 --- a/src/SerializationFormat.cc +++ b/src/SerializationFormat.cc @@ -6,8 +6,9 @@ #include "Reporter.h" SerializationFormat::SerializationFormat() + : output(), output_size(), output_pos(), input(), input_len(), input_pos(), + bytes_written(), bytes_read() { - output = 0; } SerializationFormat::~SerializationFormat() diff --git a/src/Serializer.cc b/src/Serializer.cc index bd1be77a2d..66ff98ec5d 100644 --- a/src/Serializer.cc +++ b/src/Serializer.cc @@ -1037,6 +1037,7 @@ void ConversionSerializer::GotPacket(Packet* p) } EventPlayer::EventPlayer(const char* file) + : stream_time(), replay_time(), ne_time(), ne_handler(), ne_args() { if ( ! OpenFile(file, true) || fd < 0 ) Error(fmt("event replayer: cannot open %s", file)); diff --git a/src/Serializer.h b/src/Serializer.h index 72e0723880..30095ff4fc 100644 --- a/src/Serializer.h +++ b/src/Serializer.h @@ -403,6 +403,7 @@ public: hdr_size = 0; free = arg_free; tag = arg_tag; + link_type = 0; } ~Packet() diff --git a/src/Sessions.h b/src/Sessions.h index 27b052ba2d..1788541f45 100644 --- a/src/Sessions.h +++ b/src/Sessions.h @@ -55,15 +55,12 @@ struct SessionStats { class TimerMgrExpireTimer : public Timer { public: TimerMgrExpireTimer(double t, TimerMgr* arg_mgr) - : Timer(t, TIMER_TIMERMGR_EXPIRE) - { - mgr = arg_mgr; - } + : Timer(t, TIMER_TIMERMGR_EXPIRE), mgr(arg_mgr) + { } virtual void Dispatch(double t, int is_expire); protected: - double interval; TimerMgr* mgr; }; diff --git a/src/SmithWaterman.cc b/src/SmithWaterman.cc index e051032756..5f2786caa0 100644 --- a/src/SmithWaterman.cc +++ b/src/SmithWaterman.cc @@ -11,7 +11,7 @@ #include "Reporter.h" BroSubstring::BroSubstring(const BroSubstring& bst) -: BroString((const BroString&) bst), _new(bst._new) +: BroString((const BroString&) bst), _num(), _new(bst._new) { for ( BSSAlignVecCIt it = bst._aligns.begin(); it != bst._aligns.end(); ++it ) _aligns.push_back(*it); diff --git a/src/SmithWaterman.h b/src/SmithWaterman.h index 6ea191f5d9..190ecda597 100644 --- a/src/SmithWaterman.h +++ b/src/SmithWaterman.h @@ -42,10 +42,10 @@ public: typedef BSSAlignVec::const_iterator BSSAlignVecCIt; BroSubstring(const string& string) - : BroString(string), _new(false) { } + : BroString(string), _num(), _new(false) { } BroSubstring(const BroString& string) - : BroString(string), _new(false) { } + : BroString(string), _num(), _new(false) { } BroSubstring(const BroSubstring& bst); diff --git a/src/Stats.cc b/src/Stats.cc index 9b839ec672..c4b0ed45b1 100644 --- a/src/Stats.cc +++ b/src/Stats.cc @@ -399,6 +399,7 @@ PacketProfiler::PacketProfiler(unsigned int mode, double freq, last_Utime = last_Stime = last_Rtime = 0.0; last_timestamp = time = 0.0; pkt_cnt = byte_cnt = 0; + last_mem = 0; file->Write("time dt npkts nbytes dRtime dUtime dStime dmem\n"); } diff --git a/src/Stats.h b/src/Stats.h index 8137ad16cf..1bcc2e18dc 100644 --- a/src/Stats.h +++ b/src/Stats.h @@ -29,26 +29,18 @@ public: // The constructor takes some way of identifying the segment. SegmentProfiler(SegmentStatsReporter* arg_reporter, const char* arg_name) + : reporter(arg_reporter), name(arg_name), loc(), initial_rusage() { - reporter = arg_reporter; if ( reporter ) - { - name = arg_name; - loc = 0; Init(); - } } SegmentProfiler(SegmentStatsReporter* arg_reporter, const Location* arg_loc) + : reporter(arg_reporter), name(), loc(arg_loc), initial_rusage() { - reporter = arg_reporter; if ( reporter ) - { - name = 0; - loc = arg_loc; Init(); - } } ~SegmentProfiler() diff --git a/src/Type.cc b/src/Type.cc index 706a15aea2..a6d8b90c6c 100644 --- a/src/Type.cc +++ b/src/Type.cc @@ -1564,10 +1564,8 @@ bool EnumType::DoUnserialize(UnserialInfo* info) } VectorType::VectorType(BroType* element_type) -: BroType(TYPE_VECTOR) + : BroType(TYPE_VECTOR), yield_type(element_type) { - if ( element_type ) - yield_type = element_type; } VectorType::~VectorType() diff --git a/src/Val.cc b/src/Val.cc index bd065f0d8f..d791ff195d 100644 --- a/src/Val.cc +++ b/src/Val.cc @@ -2572,6 +2572,7 @@ unsigned int TableVal::MemoryAllocation() const RecordVal::RecordVal(RecordType* t) : MutableVal(t) { + origin = 0; record_type = t; int n = record_type->NumFields(); val_list* vl = val.val_list_val = new val_list(n); diff --git a/src/Val.h b/src/Val.h index a7088313d6..33bd89c0d5 100644 --- a/src/Val.h +++ b/src/Val.h @@ -466,7 +466,7 @@ public: protected: MutableVal(BroType* t) : Val(t) { props = 0; id = 0; last_modified = SerialObj::ALWAYS; } - MutableVal() { id = 0; last_modified = SerialObj::ALWAYS; } + MutableVal() { props = 0; id = 0; last_modified = SerialObj::ALWAYS; } ~MutableVal(); friend class ID; diff --git a/src/analyzer/Analyzer.cc b/src/analyzer/Analyzer.cc index 7a71c2e0d4..03734f1a22 100644 --- a/src/analyzer/Analyzer.cc +++ b/src/analyzer/Analyzer.cc @@ -20,7 +20,7 @@ public: void Dispatch(double t, int is_expire); protected: - AnalyzerTimer() {} + AnalyzerTimer() : analyzer(), timer(), do_expire() {} void Init(Analyzer* analyzer, analyzer_timer_func timer, int do_expire); @@ -124,6 +124,7 @@ void Analyzer::CtorInit(const Tag& arg_tag, Connection* arg_conn) tag = arg_tag; id = ++id_counter; protocol_confirmed = false; + timers_canceled = false; skip = false; finished = false; removing = false; diff --git a/src/analyzer/protocol/conn-size/ConnSize.cc b/src/analyzer/protocol/conn-size/ConnSize.cc index ad08c78c4f..227a4b1be2 100644 --- a/src/analyzer/protocol/conn-size/ConnSize.cc +++ b/src/analyzer/protocol/conn-size/ConnSize.cc @@ -11,7 +11,8 @@ using namespace analyzer::conn_size; ConnSize_Analyzer::ConnSize_Analyzer(Connection* c) -: Analyzer("CONNSIZE", c) + : Analyzer("CONNSIZE", c), + orig_bytes(), resp_bytes(), orig_pkts(), resp_pkts() { } diff --git a/src/analyzer/protocol/dns/DNS.cc b/src/analyzer/protocol/dns/DNS.cc index 4901df4417..806cb9ae75 100644 --- a/src/analyzer/protocol/dns/DNS.cc +++ b/src/analyzer/protocol/dns/DNS.cc @@ -894,6 +894,7 @@ DNS_MsgInfo::DNS_MsgInfo(DNS_RawMsgHdr* hdr, int arg_is_query) answer_type = DNS_QUESTION; skip_event = 0; + tsig = 0; } DNS_MsgInfo::~DNS_MsgInfo() @@ -1002,7 +1003,7 @@ Contents_DNS::Contents_DNS(Connection* conn, bool orig, interp = arg_interp; msg_buf = 0; - buf_n = msg_size = 0; + buf_n = buf_len = msg_size = 0; state = DNS_LEN_HI; } diff --git a/src/analyzer/protocol/dns/DNS.h b/src/analyzer/protocol/dns/DNS.h index 373250e8f4..af4b8de22f 100644 --- a/src/analyzer/protocol/dns/DNS.h +++ b/src/analyzer/protocol/dns/DNS.h @@ -144,7 +144,6 @@ public: // More values for spesific DNS types. // struct EDNS_ADDITIONAL* edns; - int tsig_init; struct TSIG_DATA* tsig; }; diff --git a/src/analyzer/protocol/http/HTTP.cc b/src/analyzer/protocol/http/HTTP.cc index 71c0052b4b..4bb2385c27 100644 --- a/src/analyzer/protocol/http/HTTP.cc +++ b/src/analyzer/protocol/http/HTTP.cc @@ -534,6 +534,7 @@ HTTP_Message::HTTP_Message(HTTP_Analyzer* arg_analyzer, top_level = new HTTP_Entity(this, 0, expect_body); BeginEntity(top_level); + buffer_offset = buffer_size = 0; data_buffer = 0; total_buffer_size = 0; diff --git a/src/analyzer/protocol/icmp/ICMP.cc b/src/analyzer/protocol/icmp/ICMP.cc index a851ebe8ee..048c6e51ce 100644 --- a/src/analyzer/protocol/icmp/ICMP.cc +++ b/src/analyzer/protocol/icmp/ICMP.cc @@ -17,11 +17,10 @@ using namespace analyzer::icmp; ICMP_Analyzer::ICMP_Analyzer(Connection* c) -: TransportLayerAnalyzer("ICMP", c) + : TransportLayerAnalyzer("ICMP", c), + icmp_conn_val(), type(), code(), request_len(-1), reply_len(-1) { - icmp_conn_val = 0; c->SetInactivityTimeout(icmp_inactivity_timeout); - request_len = reply_len = -1; } void ICMP_Analyzer::Done() diff --git a/src/analyzer/protocol/login/Login.cc b/src/analyzer/protocol/login/Login.cc index 335b855f1d..de2445d81f 100644 --- a/src/analyzer/protocol/login/Login.cc +++ b/src/analyzer/protocol/login/Login.cc @@ -25,7 +25,7 @@ static RE_Matcher* re_login_timeouts; static RE_Matcher* init_RE(ListVal* l); Login_Analyzer::Login_Analyzer(const char* name, Connection* conn) -: tcp::TCP_ApplicationAnalyzer(name, conn) + : tcp::TCP_ApplicationAnalyzer(name, conn), user_text() { state = LOGIN_STATE_AUTHENTICATE; num_user_lines_seen = lines_scanned = 0; diff --git a/src/analyzer/protocol/login/NVT.cc b/src/analyzer/protocol/login/NVT.cc index 62e4d0c050..752ce54df2 100644 --- a/src/analyzer/protocol/login/NVT.cc +++ b/src/analyzer/protocol/login/NVT.cc @@ -364,14 +364,11 @@ void TelnetBinaryOption::InconsistentOption(unsigned int /* type */) NVT_Analyzer::NVT_Analyzer(Connection* conn, bool orig) -: tcp::ContentLine_Analyzer("NVT", conn, orig) + : tcp::ContentLine_Analyzer("NVT", conn, orig), + peer(), pending_IAC(), IAC_pos(), is_suboption(), last_was_IAC(), + binary_mode(), encrypting_mode(), authentication_has_been_accepted(), + auth_name(), options(), num_options() { - peer = 0; - is_suboption = last_was_IAC = pending_IAC = 0; - IAC_pos = 0; - num_options = 0; - authentication_has_been_accepted = encrypting_mode = binary_mode = 0; - auth_name = 0; } NVT_Analyzer::~NVT_Analyzer() diff --git a/src/analyzer/protocol/login/RSH.cc b/src/analyzer/protocol/login/RSH.cc index e70fae1b8c..8aebb89116 100644 --- a/src/analyzer/protocol/login/RSH.cc +++ b/src/analyzer/protocol/login/RSH.cc @@ -22,7 +22,10 @@ Contents_Rsh_Analyzer::Contents_Rsh_Analyzer(Connection* conn, bool orig, if ( orig ) state = save_state = RSH_FIRST_NULL; else + { state = RSH_LINE_MODE; + save_state = RSH_UNKNOWN; + } } Contents_Rsh_Analyzer::~Contents_Rsh_Analyzer() diff --git a/src/analyzer/protocol/mime/MIME.cc b/src/analyzer/protocol/mime/MIME.cc index 5748bece86..c66a0b9be7 100644 --- a/src/analyzer/protocol/mime/MIME.cc +++ b/src/analyzer/protocol/mime/MIME.cc @@ -1257,7 +1257,7 @@ TableVal* MIME_Message::BuildHeaderTable(MIME_HeaderList& hlist) } MIME_Mail::MIME_Mail(analyzer::Analyzer* mail_analyzer, int buf_size) -: MIME_Message(mail_analyzer) + : MIME_Message(mail_analyzer), md5_hash() { analyzer = mail_analyzer; @@ -1280,12 +1280,13 @@ MIME_Mail::MIME_Mail(analyzer::Analyzer* mail_analyzer, int buf_size) if ( mime_content_hash ) { compute_content_hash = 1; - content_hash_length = 0; md5_init(&md5_hash); } else compute_content_hash = 0; + content_hash_length = 0; + top_level = new MIME_Entity(this, 0); // to be changed to MIME_Mail BeginEntity(top_level); } diff --git a/src/analyzer/protocol/mime/MIME.h b/src/analyzer/protocol/mime/MIME.h index 4d7a89f37a..8d83609cc1 100644 --- a/src/analyzer/protocol/mime/MIME.h +++ b/src/analyzer/protocol/mime/MIME.h @@ -247,7 +247,6 @@ protected: int max_chunk_length; int buffer_start; int data_start; - int buffer_offset; int compute_content_hash; int content_hash_length; MD5_CTX md5_hash; diff --git a/src/analyzer/protocol/netbios/NetbiosSSN.cc b/src/analyzer/protocol/netbios/NetbiosSSN.cc index bed906135e..4d6ed8e1f1 100644 --- a/src/analyzer/protocol/netbios/NetbiosSSN.cc +++ b/src/analyzer/protocol/netbios/NetbiosSSN.cc @@ -346,7 +346,7 @@ Contents_NetbiosSSN::Contents_NetbiosSSN(Connection* conn, bool orig, interp = arg_interp; type = flags = msg_size = 0; msg_buf = 0; - buf_n = msg_size = 0; + buf_n = buf_len = msg_size = 0; state = NETBIOS_SSN_TYPE; } diff --git a/src/analyzer/protocol/pia/PIA.cc b/src/analyzer/protocol/pia/PIA.cc index 81c7251820..e94053b8a5 100644 --- a/src/analyzer/protocol/pia/PIA.cc +++ b/src/analyzer/protocol/pia/PIA.cc @@ -7,9 +7,8 @@ using namespace analyzer::pia; PIA::PIA(analyzer::Analyzer* arg_as_analyzer) + : state(INIT), as_analyzer(arg_as_analyzer), conn(), current_packet() { - current_packet.data = 0; - as_analyzer = arg_as_analyzer; } PIA::~PIA() diff --git a/src/analyzer/protocol/pop3/POP3.cc b/src/analyzer/protocol/pop3/POP3.cc index ccbbb8df04..52f9eb8445 100644 --- a/src/analyzer/protocol/pop3/POP3.cc +++ b/src/analyzer/protocol/pop3/POP3.cc @@ -43,6 +43,9 @@ POP3_Analyzer::POP3_Analyzer(Connection* conn) multiLine = false; backOff = false; + lastRequiredCommand = 0; + authLines = 0; + mail = 0; AddSupportAnalyzer(new tcp::ContentLine_Analyzer(conn, true)); diff --git a/src/analyzer/protocol/rpc/RPC.cc b/src/analyzer/protocol/rpc/RPC.cc index ea037c227f..559e629e57 100644 --- a/src/analyzer/protocol/rpc/RPC.cc +++ b/src/analyzer/protocol/rpc/RPC.cc @@ -679,10 +679,9 @@ void Contents_RPC::DeliverStream(int len, const u_char* data, bool orig) RPC_Analyzer::RPC_Analyzer(const char* name, Connection* conn, RPC_Interpreter* arg_interp) -: tcp::TCP_ApplicationAnalyzer(name, conn) + : tcp::TCP_ApplicationAnalyzer(name, conn), + interp(arg_interp), orig_rpc(), resp_rpc() { - interp = arg_interp; - if ( Conn()->ConnTransport() == TRANSPORT_UDP ) ADD_ANALYZER_TIMER(&RPC_Analyzer::ExpireTimer, network_time + rpc_timeout, 1, TIMER_RPC_EXPIRE); diff --git a/src/analyzer/protocol/smb/SMB.cc b/src/analyzer/protocol/smb/SMB.cc index 798e2bfd1f..4393626217 100644 --- a/src/analyzer/protocol/smb/SMB.cc +++ b/src/analyzer/protocol/smb/SMB.cc @@ -100,6 +100,9 @@ static int lookup_IPC_name(BroString* name) SMB_Session::SMB_Session(analyzer::Analyzer* arg_analyzer) { analyzer = arg_analyzer; + req_cmd = 0; + smb_mailslot_prot = false; + smb_pipe_prot = false; dce_rpc_session = 0; init_SMB_command_name(); diff --git a/src/analyzer/protocol/tcp/TCP.cc b/src/analyzer/protocol/tcp/TCP.cc index c9cd8ed8d1..4631833dca 100644 --- a/src/analyzer/protocol/tcp/TCP.cc +++ b/src/analyzer/protocol/tcp/TCP.cc @@ -2043,7 +2043,8 @@ RecordVal* TCPStats_Endpoint::BuildStats() } TCPStats_Analyzer::TCPStats_Analyzer(Connection* c) -: TCP_ApplicationAnalyzer("TCPSTATS", c) + : TCP_ApplicationAnalyzer("TCPSTATS", c), + orig_stats(), resp_stats() { } diff --git a/src/analyzer/protocol/tcp/TCP_Endpoint.cc b/src/analyzer/protocol/tcp/TCP_Endpoint.cc index 3beafdeb8a..144d4598dd 100644 --- a/src/analyzer/protocol/tcp/TCP_Endpoint.cc +++ b/src/analyzer/protocol/tcp/TCP_Endpoint.cc @@ -25,12 +25,15 @@ TCP_Endpoint::TCP_Endpoint(TCP_Analyzer* arg_analyzer, int arg_is_orig) window_scale = 0; window_seq = window_ack_seq = 0; contents_start_seq = 0; + FIN_seq = 0; SYN_cnt = FIN_cnt = RST_cnt = 0; did_close = 0; contents_file = 0; tcp_analyzer = arg_analyzer; is_orig = arg_is_orig; + hist_last_SYN = hist_last_FIN = hist_last_RST = 0; + src_addr = is_orig ? tcp_analyzer->Conn()->RespAddr() : tcp_analyzer->Conn()->OrigAddr(); dst_addr = is_orig ? tcp_analyzer->Conn()->OrigAddr() : diff --git a/src/bif_arg.cc b/src/bif_arg.cc index 64b0cb131a..92e228032b 100644 --- a/src/bif_arg.cc +++ b/src/bif_arg.cc @@ -28,6 +28,7 @@ BuiltinFuncArg::BuiltinFuncArg(const char* arg_name, int arg_type) name = arg_name; type = arg_type; type_str = ""; + attr_str = ""; } BuiltinFuncArg::BuiltinFuncArg(const char* arg_name, const char* arg_type_str, diff --git a/src/file_analysis/analyzer/unified2/Unified2.h b/src/file_analysis/analyzer/unified2/Unified2.h index bd172d2b6b..c2ee9e00da 100644 --- a/src/file_analysis/analyzer/unified2/Unified2.h +++ b/src/file_analysis/analyzer/unified2/Unified2.h @@ -30,7 +30,6 @@ private: binpac::Unified2::Unified2_Analyzer* interp; string filename; - int fd; }; } // namespace file_analysis diff --git a/src/input/Manager.cc b/src/input/Manager.cc index f76ab67f0d..e2562338c8 100644 --- a/src/input/Manager.cc +++ b/src/input/Manager.cc @@ -84,16 +84,16 @@ public: RecordVal* description; - Stream(); virtual ~Stream(); + +protected: + Stream(StreamType t); }; -Manager::Stream::Stream() +Manager::Stream::Stream(StreamType t) + : name(), removed(), stream_type(t), type(), reader(), config(), + description() { - type = 0; - reader = 0; - description = 0; - removed = false; } Manager::Stream::~Stream() @@ -154,24 +154,17 @@ public: ~AnalysisStream(); }; -Manager::TableStream::TableStream() : Manager::Stream::Stream() +Manager::TableStream::TableStream() + : Manager::Stream::Stream(TABLE_STREAM), + num_idx_fields(), num_val_fields(), want_record(), tab(), rtype(), + itype(), currDict(), lastDict(), pred(), event() { - stream_type = TABLE_STREAM; - - tab = 0; - itype = 0; - rtype = 0; - - currDict = 0; - lastDict = 0; - - pred = 0; } -Manager::EventStream::EventStream() : Manager::Stream::Stream() +Manager::EventStream::EventStream() + : Manager::Stream::Stream(EVENT_STREAM), + event(), fields(), num_fields(), want_record() { - fields = 0; - stream_type = EVENT_STREAM; } Manager::EventStream::~EventStream() @@ -204,9 +197,9 @@ Manager::TableStream::~TableStream() } } -Manager::AnalysisStream::AnalysisStream() : Manager::Stream::Stream() +Manager::AnalysisStream::AnalysisStream() + : Manager::Stream::Stream(ANALYSIS_STREAM), file_id() { - stream_type = ANALYSIS_STREAM; } Manager::AnalysisStream::~AnalysisStream() diff --git a/src/input/ReaderBackend.cc b/src/input/ReaderBackend.cc index 0aaadc3cdc..abf369dd54 100644 --- a/src/input/ReaderBackend.cc +++ b/src/input/ReaderBackend.cc @@ -163,6 +163,8 @@ ReaderBackend::ReaderBackend(ReaderFrontend* arg_frontend) : MsgThread() disabled = true; // disabled will be set correcty in init. frontend = arg_frontend; info = new ReaderInfo(frontend->Info()); + num_fields = 0; + fields = 0; SetName(frontend->Name()); } diff --git a/src/input/readers/Ascii.cc b/src/input/readers/Ascii.cc index 687d37c96f..8f61e17fc0 100644 --- a/src/input/readers/Ascii.cc +++ b/src/input/readers/Ascii.cc @@ -18,7 +18,7 @@ using threading::Value; using threading::Field; FieldMapping::FieldMapping(const string& arg_name, const TypeTag& arg_type, int arg_position) - : name(arg_name), type(arg_type) + : name(arg_name), type(arg_type), subtype(TYPE_ERROR) { position = arg_position; secondary_position = -1; @@ -49,6 +49,7 @@ FieldMapping FieldMapping::subType() Ascii::Ascii(ReaderFrontend *frontend) : ReaderBackend(frontend) { file = 0; + mtime = 0; separator.assign( (const char*) BifConst::InputAscii::separator->Bytes(), BifConst::InputAscii::separator->Len()); diff --git a/src/input/readers/Benchmark.cc b/src/input/readers/Benchmark.cc index 3e53dfb35f..ec6b382ebb 100644 --- a/src/input/readers/Benchmark.cc +++ b/src/input/readers/Benchmark.cc @@ -18,6 +18,7 @@ using threading::Field; Benchmark::Benchmark(ReaderFrontend *frontend) : ReaderBackend(frontend) { + num_lines = 0; multiplication_factor = double(BifConst::InputBenchmark::factor); autospread = double(BifConst::InputBenchmark::autospread); spread = int(BifConst::InputBenchmark::spread); @@ -25,6 +26,7 @@ Benchmark::Benchmark(ReaderFrontend *frontend) : ReaderBackend(frontend) autospread_time = 0; stopspreadat = int(BifConst::InputBenchmark::stopspreadat); timedspread = double(BifConst::InputBenchmark::timedspread); + heartbeatstarttime = 0; heartbeat_interval = double(BifConst::Threading::heartbeat_interval); ascii = new AsciiFormatter(this, AsciiFormatter::SeparatorInfo()); diff --git a/src/input/readers/Raw.cc b/src/input/readers/Raw.cc index 70c24eed76..1947a907cb 100644 --- a/src/input/readers/Raw.cc +++ b/src/input/readers/Raw.cc @@ -34,6 +34,9 @@ Raw::Raw(ReaderFrontend *frontend) : ReaderBackend(frontend) { file = 0; stderrfile = 0; + execute = false; + firstrun = true; + mtime = 0; forcekill = false; separator.assign( (const char*) BifConst::InputRaw::record_separator->Bytes(), BifConst::InputRaw::record_separator->Len()); diff --git a/src/input/readers/SQLite.cc b/src/input/readers/SQLite.cc index 84b57e2509..abb155e3bc 100644 --- a/src/input/readers/SQLite.cc +++ b/src/input/readers/SQLite.cc @@ -17,7 +17,9 @@ using namespace input::reader; using threading::Value; using threading::Field; -SQLite::SQLite(ReaderFrontend *frontend) : ReaderBackend(frontend) +SQLite::SQLite(ReaderFrontend *frontend) + : ReaderBackend(frontend), + fields(), num_fields(), mode(), started(), query(), db(), st() { set_separator.assign( (const char*) BifConst::LogSQLite::set_separator->Bytes(), diff --git a/src/logging/WriterFrontend.cc b/src/logging/WriterFrontend.cc index 1e254bfc83..09490ce3d1 100644 --- a/src/logging/WriterFrontend.cc +++ b/src/logging/WriterFrontend.cc @@ -112,6 +112,9 @@ WriterFrontend::WriterFrontend(const WriterBackend::WriterInfo& arg_info, EnumVa write_buffer_pos = 0; info = new WriterBackend::WriterInfo(arg_info); + num_fields = 0; + fields = 0; + const char* w = arg_writer->Type()->AsEnumType()->Lookup(arg_writer->InternalInt()); name = copy_string(fmt("%s/%s", arg_info.path, w)); diff --git a/src/logging/writers/DataSeries.cc b/src/logging/writers/DataSeries.cc index 087a7061ea..1073e31a08 100644 --- a/src/logging/writers/DataSeries.cc +++ b/src/logging/writers/DataSeries.cc @@ -233,6 +233,10 @@ DataSeries::DataSeries(WriterFrontend* frontend) : WriterBackend(frontend) ds_set_separator = ","; ascii = new AsciiFormatter(this, AsciiFormatter::SeparatorInfo()); + + compress_type = Extent::compress_none; + log_file = 0; + log_output = 0; } DataSeries::~DataSeries() diff --git a/src/logging/writers/SQLite.cc b/src/logging/writers/SQLite.cc index 81c52fe198..c1614f1aed 100644 --- a/src/logging/writers/SQLite.cc +++ b/src/logging/writers/SQLite.cc @@ -16,7 +16,9 @@ using namespace writer; using threading::Value; using threading::Field; -SQLite::SQLite(WriterFrontend* frontend) : WriterBackend(frontend) +SQLite::SQLite(WriterFrontend* frontend) + : WriterBackend(frontend), + fields(), num_fields(), db(), st() { set_separator.assign( (const char*) BifConst::LogSQLite::set_separator->Bytes(), @@ -33,9 +35,7 @@ SQLite::SQLite(WriterFrontend* frontend) : WriterBackend(frontend) BifConst::LogSQLite::empty_field->Len() ); - db = 0; io = new AsciiFormatter(this, AsciiFormatter::SeparatorInfo(set_separator, unset_field, empty_field)); - st = 0; } SQLite::~SQLite() diff --git a/src/threading/SerialTypes.h b/src/threading/SerialTypes.h index 8a4f46a15c..e056f6c170 100644 --- a/src/threading/SerialTypes.h +++ b/src/threading/SerialTypes.h @@ -81,7 +81,7 @@ private: friend class ::RemoteSerializer; // Force usage of constructor above. - Field() {}; + Field() {} }; /**