mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 08:38:20 +00:00
Improve error messages from to_addr and to_subnet BIFs
Related to GH-514
This commit is contained in:
parent
ac7daf8456
commit
ec4df80c67
9 changed files with 115 additions and 30 deletions
13
src/Val.cc
13
src/Val.cc
|
@ -863,19 +863,10 @@ Val* AddrVal::DoClone(CloneState* state)
|
|||
|
||||
SubNetVal::SubNetVal(const char* text) : Val(TYPE_SUBNET)
|
||||
{
|
||||
string s(text);
|
||||
size_t slash_loc = s.find('/');
|
||||
val.subnet_val = new IPPrefix();
|
||||
|
||||
if ( slash_loc == string::npos )
|
||||
{
|
||||
if ( ! IPPrefix::ConvertString(text, val.subnet_val) )
|
||||
reporter->Error("Bad string in SubNetVal ctor: %s", text);
|
||||
val.subnet_val = new IPPrefix();
|
||||
}
|
||||
else
|
||||
{
|
||||
val.subnet_val = new IPPrefix(s.substr(0, slash_loc),
|
||||
atoi(s.substr(slash_loc + 1).c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
SubNetVal::SubNetVal(const char* text, int width) : Val(TYPE_SUBNET)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue