"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/service_inspectors/wizard/hexes.cc" between
snort3-3.1.29.0.tar.gz and snort3-3.1.30.0.tar.gz

About: Snort 3 is a network intrusion prevention and detection system (IDS/IPS) combining the benefits of signature, protocol and anomaly-based inspection.

hexes.cc  (snort3-3.1.29.0):hexes.cc  (snort3-3.1.30.0)
skipping to change at line 59 skipping to change at line 59
} }
else if ( !hex ) else if ( !hex )
{ {
if ( in[i] == '?' ) if ( in[i] == '?' )
out.emplace_back(WILD); out.emplace_back(WILD);
else else
out.emplace_back(in[i]); out.emplace_back(in[i]);
} }
else if ( in[i] != ' ' ) else if ( in[i] != ' ' )
{ {
if ( !isxdigit(in[i]) || byte.size() > 1 ) if ( !isxdigit(in[i]) or byte.size() > 1 )
return false; return false;
byte += in[i]; byte += in[i];
} }
else else
push = true; push = true;
if ( push && !byte.empty() ) if ( push and !byte.empty() )
{ {
int b = strtol(byte.c_str(), nullptr, 16); int b = strtol(byte.c_str(), nullptr, 16);
out.emplace_back((uint8_t)b); out.emplace_back((uint8_t)b);
byte.clear(); byte.clear();
} }
++i; ++i;
} }
return true; return true;
} }
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
void HexBook::add_spell( void HexBook::add_spell(
const char* key, const char* val, HexVector& hv, unsigned i, MagicPage* p) const char* key, const char* val, HexVector& hv, unsigned i, MagicPage* p)
{ {
while ( i < hv.size() ) while ( i < hv.size() )
{ {
skipping to change at line 96 skipping to change at line 98
int c = hv[i]; int c = hv[i];
if ( c == WILD ) if ( c == WILD )
p->any = t; p->any = t;
else else
p->next[c] = t; p->next[c] = t;
p = t; p = t;
++i; ++i;
} }
p->key = key; p->key = key;
p->value = SnortConfig::get_static_name(val); p->value = SnortConfig::get_static_name(val);
} }
bool HexBook::add_spell(const char* key, const char*& val) bool HexBook::add_spell(const char* key, const char*& val)
{ {
HexVector hv; HexVector hv;
if ( !translate(key, hv) ) if ( !translate(key, hv) )
{ {
val = nullptr; val = nullptr;
return false; return false;
} }
unsigned i = 0; unsigned i = 0;
MagicPage* p = root; MagicPage* p = root;
while ( i < hv.size() ) while ( i < hv.size() )
{ {
int c = hv[i]; int c = hv[i];
if ( c == WILD && p->any ) if ( c == WILD and p->any )
p = p->any; p = p->any;
else if ( p->next[c] ) else if ( p->next[c] )
p = p->next[c]; p = p->next[c];
else else
break; break;
++i; ++i;
} }
if ( p->key == key ) if ( p->key == key )
{ {
val = p->value; val = p->value;
return false; return false;
} }
add_spell(key, val, hv, i, p); add_spell(key, val, hv, i, p);
return true; return true;
} }
const MagicPage* HexBook::find_spell( const MagicPage* HexBook::find_spell(
const uint8_t* s, unsigned n, const MagicPage* p, unsigned i, const MagicPag e*& bookmark) const const uint8_t* s, unsigned n, const MagicPage* p, unsigned i, const MagicPag e*& bookmark) const
{ {
while ( i < n ) while ( i < n )
{ {
int c = s[i]; int c = s[i];
skipping to change at line 164 skipping to change at line 170
p = p->next[c]; p = p->next[c];
++i; ++i;
continue; continue;
} }
} }
if ( p->any ) if ( p->any )
{ {
if ( const MagicPage* q = find_spell(s, n, p->any, i+1, bookmark) ) if ( const MagicPage* q = find_spell(s, n, p->any, i+1, bookmark) )
return q; return q;
} }
return p->value ? p : nullptr; return p->value ? p : nullptr;
} }
return p; return p;
} }
 End of changes. 11 change blocks. 
3 lines changed or deleted 11 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)