From: Michael Altizer (mialtize) Date: Wed, 5 Oct 2016 15:51:43 +0000 (-0400) Subject: Merge pull request #655 in SNORT/snort3 from crc_broke to master X-Git-Tag: 3.0.0-233~239 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f28d04e627170c941d273badcd9a0a01c71100e9;p=thirdparty%2Fsnort3.git Merge pull request #655 in SNORT/snort3 from crc_broke to master Squashed commit of the following: commit 3e08a91b4236cd8ad7c4cae72110aac2269dbdfd Author: Russ Combs Date: Wed Oct 5 10:15:39 2016 -0400 fix several static analysis issues --- diff --git a/extra/src/inspectors/http_server/hi_server.cc b/extra/src/inspectors/http_server/hi_server.cc index b8f66772d..7f540a538 100644 --- a/extra/src/inspectors/http_server/hi_server.cc +++ b/extra/src/inspectors/http_server/hi_server.cc @@ -1673,7 +1673,7 @@ static int HttpResponseInspection(HI_SESSION* session, Packet* p, const unsigned } } - if ((sd->utf_state->get_decode_utf_state_charset() != CHARSET_DEFAULT) + if ((sd && sd->utf_state->get_decode_utf_state_charset() != CHARSET_DEFAULT) || (ServerConf->normalize_javascript && Server->response.body_size)) { if ( Server->response.body_size < sizeof(HttpDecodeBuf.data) ) diff --git a/src/log/messages.cc b/src/log/messages.cc index b3f8c2bf7..1d5de9f51 100644 --- a/src/log/messages.cc +++ b/src/log/messages.cc @@ -501,10 +501,13 @@ char* ObfuscateIpToText(const sfip_t* ip) return ip_buf; } -// FIXIT-M add throttling so we don't spam syslog -NORETURN void log_safec_error(const char* msg, void*, int e) +void log_safec_error(const char* msg, void*, int e) { - ErrorMessage("SafeC error %i: %s\n", e, msg); + static THREAD_LOCAL unsigned safec_errors = 0; + + if ( ++safec_errors < 1000 ) + ErrorMessage("SafeC error %i: %s\n", e, msg); + assert(false); } diff --git a/src/network_inspectors/appid/appid_session.cc b/src/network_inspectors/appid/appid_session.cc index 8b7fe3068..ecc75ece1 100644 --- a/src/network_inspectors/appid/appid_session.cc +++ b/src/network_inspectors/appid/appid_session.cc @@ -1929,8 +1929,9 @@ void AppIdSession::do_application_discovery(Packet* p) } else if (protocol != IpProtocol::TCP || !p->dsize || (p->packet_flags & PKT_STREAM_ORDER_OK)) { - isTpAppidDiscoveryDone = session->do_service_discovery(protocol, direction, ClientAppId, - payloadAppId, p); + // FIXIT-M commented out assignment causes analysis warning + /*isTpAppidDiscoveryDone = */ + session->do_service_discovery(protocol, direction, ClientAppId, payloadAppId, p); isTpAppidDiscoveryDone = session->do_client_discovery(direction, p); session->setAppIdFlag(APPID_SESSION_ADDITIONAL_PACKET); } diff --git a/src/network_inspectors/appid/detector_plugins/detector_http.cc b/src/network_inspectors/appid/detector_plugins/detector_http.cc index ef192dcf3..88ebd517d 100644 --- a/src/network_inspectors/appid/detector_plugins/detector_http.cc +++ b/src/network_inspectors/appid/detector_plugins/detector_http.cc @@ -441,7 +441,7 @@ void insert_url_pattern(DetectorAppUrlPattern* pattern) if (!tmp) { FreeDetectorAppUrlPattern(pattern); - //return 0; + return; } urlList->urlPattern = tmp; urlList->allocatedCount += URL_LIST_STEP_SIZE; @@ -463,7 +463,7 @@ void insert_rtmp_url_pattern(DetectorAppUrlPattern* pattern) if (!tmp) { FreeDetectorAppUrlPattern(pattern); - //return 0; + return; } urlList->urlPattern = tmp; urlList->allocatedCount += URL_LIST_STEP_SIZE; @@ -485,7 +485,7 @@ void insert_app_url_pattern(DetectorAppUrlPattern* pattern) if (!tmp) { FreeDetectorAppUrlPattern(pattern); - //return 0; + return; } urlList->urlPattern = tmp; urlList->allocatedCount += URL_LIST_STEP_SIZE; diff --git a/src/network_inspectors/appid/lua_detector_module.cc b/src/network_inspectors/appid/lua_detector_module.cc index 3facbf485..987f98842 100644 --- a/src/network_inspectors/appid/lua_detector_module.cc +++ b/src/network_inspectors/appid/lua_detector_module.cc @@ -325,7 +325,9 @@ static void luaClientInit(Detector* detector) return; } else + { DebugFormat(DEBUG_APPID, "Initialized %s\n", detector->name.c_str()); + } } static void luaClientFini(Detector* detector) @@ -368,8 +370,9 @@ static inline void setLuaTrackerSize(lua_State* L, uint32_t numTrackers) } } else + { DebugMessage(DEBUG_LOG, "hostServiceTrackerModule.setHosServiceTrackerSize not found"); - + } lua_pop(L, 1); /*change flow tracker size according to available memory calculation */ @@ -385,8 +388,9 @@ static inline void setLuaTrackerSize(lua_State* L, uint32_t numTrackers) } } else + { DebugMessage(DEBUG_LOG, "flowTrackerModule.setFlowTrackerSize not found"); - + } lua_pop(L, 1); }