mirror of
https://github.com/zeek/zeek.git
synced 2025-10-14 12:38:20 +00:00
Add type checking to string_cat arguments
This commit is contained in:
parent
686eb54f95
commit
ed4521af60
6 changed files with 37 additions and 0 deletions
|
@ -64,7 +64,15 @@ function string_cat%(...%): string
|
|||
%{
|
||||
int n = 0;
|
||||
for ( const auto& a : @ARG@ )
|
||||
{
|
||||
if ( a->GetType()->Tag() != TYPE_STRING )
|
||||
{
|
||||
zeek::reporter->Error("string_cat() requires string arguments");
|
||||
return val_mgr->EmptyString();
|
||||
}
|
||||
|
||||
n += a->AsString()->Len();
|
||||
}
|
||||
|
||||
u_char* b = new u_char[n+1];
|
||||
zeek::String* s = new zeek::String(1, b, n);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue