]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #1591 in SNORT/snort3 from ~MIALTIZE/snort3:static_analysis to...
authorMichael Altizer (mialtize) <mialtize@cisco.com>
Tue, 30 Apr 2019 15:40:05 +0000 (11:40 -0400)
committerMichael Altizer (mialtize) <mialtize@cisco.com>
Tue, 30 Apr 2019 15:40:05 +0000 (11:40 -0400)
Squashed commit of the following:

commit b1dd6db8cc79cc8b0881f508f1c1679165aa92b1
Author: Michael Altizer <mialtize@cisco.com>
Date:   Wed Apr 24 15:39:22 2019 -0400

    piglet_plugins: Don't try to memset SigInfo

commit 846cd74233e2e6de40528e364bb10b5be8421848
Author: Michael Altizer <mialtize@cisco.com>
Date:   Mon Apr 22 13:02:37 2019 -0400

    tcp_connector: Fix memory leak in receive overrun scenario

commit f168872f04abdc26d1ebcb7bc43977b0ecd8bc4e
Author: Michael Altizer <mialtize@cisco.com>
Date:   Mon Apr 22 12:49:41 2019 -0400

    appid: Add assertion to pop3 detector to quiet the static analyzer

commit 7d190cd75022d2cc4e0400e10406c7a182504566
Author: Michael Altizer <mialtize@cisco.com>
Date:   Mon Apr 22 12:36:37 2019 -0400

    module_manager: Fix potential null deref in module parameter dumping

src/connectors/tcp_connector/tcp_connector.cc
src/managers/module_manager.cc
src/network_inspectors/appid/detector_plugins/detector_pop3.cc
src/piglet_plugins/pp_event_iface.cc

index affdd4f1de1d9f16469cb5f4750b1cb63322852f..4a61801d32cef179e6e31bbbf04acdd3d0ebd93a 100644 (file)
@@ -184,10 +184,12 @@ void TcpConnector::process_receive()
     }
     else if (rval > 0 && pfds[0].revents & POLLIN)
     {
-        TcpConnectorMsgHandle* handle;
-        if ( (handle = read_message(sock_fd)) != nullptr )
-            if ( !receive_ring->put(handle) )
-                ErrorMessage("TcpC Input Thread: overrun\n");
+        TcpConnectorMsgHandle* handle = read_message(sock_fd);
+        if (handle && !receive_ring->put(handle))
+        {
+            ErrorMessage("TcpC Input Thread: overrun\n");
+            delete handle;
+        }
     }
 }
 
index 60a9e9c71f6a5599b0105ff7abc55a9b0bfd352c..dc37b2a9455fcb636878770e2e3ceab13cd28b8c 100644 (file)
@@ -1017,7 +1017,7 @@ void ModuleManager::show_module(const char* name)
         const Parameter* def_params = m->get_default_parameters();
 
         if ( ( params and params->type < Parameter::PT_MAX ) ||
-             ( def_params and params->type < Parameter::PT_MAX ) )
+             ( def_params and def_params->type < Parameter::PT_MAX ) )
         {
             cout << endl << "Configuration: " << endl << endl;
             show_configs(name, true);
index 32ca4efa016de6592f3a3abe7d9caf630744d7e4..73ec4c231c628e182ec437ba61094f5995621c7c 100644 (file)
@@ -288,6 +288,7 @@ static int pop3_server_validate(POP3DetectorData* dd, const uint8_t* data, uint1
     ServicePOP3Data* pd = &dd->server;
     const uint8_t* begin = nullptr;
 
+    assert(data);
     const uint8_t* end = data + size;
     char* v_end = pd->version + MAX_VERSION_SIZE - 1;
     switch (pd->state)
index 7d01dfed25844831b39e955699c5e0424a535723..e1ce5a419ef6b5b0c56205c96a5d4f303c150114 100644 (file)
@@ -33,8 +33,7 @@
 
 static struct SigInfo* create_sig_info()
 {
-    auto si = new SigInfo;
-    memset(si, 0, sizeof(SigInfo));
+    auto si = new SigInfo();
     return si;
 }