malformed regular expression

Vern Paxson vern at ee.lbl.gov
Wed May 2 16:54:17 PDT 2001


The problem is that Bro was incorrectly processing an empty regular
expression (corresponding to the "skip_authentication" variable,
which was empty because you commented out its redefinition).

Here's a patch.

		Vern


*** RE.cc.ORIG	Sun Oct 24 22:55:24 1999
--- RE.cc	Wed May  2 16:48:03 2001
***************
*** 428,437 ****
  int Specific_RE_Matcher::MatchAll(byte_vec bv, int n)
  	{
  	if ( ! dfa )
! 		{
! 		run_time("attempt to match to a malformed regular expression");
! 		return 0;
! 		}
  
  	DFA_State* d = dfa->StartState();
  	while ( d )
--- 428,436 ----
  int Specific_RE_Matcher::MatchAll(byte_vec bv, int n)
  	{
  	if ( ! dfa )
! 		// An empty pattern matches "all" iff what's being
! 		// matched is empty.
! 		return n == 0;
  
  	DFA_State* d = dfa->StartState();
  	while ( d )
***************
*** 449,458 ****
  int Specific_RE_Matcher::Match(byte_vec bv, int n)
  	{
  	if ( ! dfa )
! 		{
! 		run_time("attempt to match to a malformed regular expression");
! 		return 0;
! 		}
  
  	DFA_State* d = dfa->StartState();
  
--- 448,455 ----
  int Specific_RE_Matcher::Match(byte_vec bv, int n)
  	{
  	if ( ! dfa )
! 		// An empty pattern matches anything.
! 		return 1;
  
  	DFA_State* d = dfa->StartState();
  



More information about the Bro mailing list