Merge in SNORT/snort3 from ~MDAGON/snort3:coverity to master
Squashed commit of the following:
commit
5085ae69eeeb397398e4e72704ab917a65c1c178
Author: maya dagon <mdagon@cisco.com>
Date: Fri Oct 20 12:12:41 2023 -0400
src: fix coverity warnings
/* Call OptTreeNode specific output functions */
if (otn->outputFuncs)
{
- ListHead lh; // FIXIT-L use of ListHead for CallLogFuncs() is a little unwieldy here
+ ListHead lh = {}; // FIXIT-L use of ListHead for CallLogFuncs() is a little unwieldy here
lh.LogList = otn->outputFuncs;
CallLogFuncs(p, otn, &lh);
}
child->evaluate = opt_fp->OptTestFunc;
child->num_children++;
child->children = (detection_option_tree_node_t**)
- snort_calloc(child->num_children, sizeof(child->children));
+ snort_calloc(child->num_children, sizeof(detection_option_tree_node_t*));
child->is_relative = opt_fp->isRelative;
bud->num_children++;
else
{
- ParseError("unknown tunnel bypass protocol");
+ ParseError("unknown tunnel bypass protocol %s", tok);
+ snort_free(tmp);
return;
}
if ( c == WILD and p->any )
p = p->any;
-
- else if ( p->next[c] )
+ else if ( c != WILD and p->next[c] )
p = p->next[c];
else
if ( !(p->packet_flags & PKT_STATELESS) )
{
drop_traffic(p, SSN_DIR_BOTH);
- p->active->set_drop_reason("stream");
+ if (p->active)
+ p->active->set_drop_reason("stream");
if (PacketTracer::is_active())
PacketTracer::log("Stream: pending block, drop\n");
}
std::size_t first_non_white_char = tmp.find_first_not_of(" \f\n\r\t\v");
std::size_t last_non_space = tmp.find_last_not_of(' ');
- bool comment = (tmp[first_non_white_char] == '#') or (tmp[first_non_white_char] == ';');
+ bool comment = (first_non_white_char != std::string::npos) and ((tmp[first_non_white_char] == '#') or
+ (tmp[first_non_white_char] == ';'));
bool commented_rule = tmp.substr(0, 7) == "# alert";
if ( !commented_rule && ((first_non_white_char == std::string::npos) || comment) )