mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 00:58:19 +00:00
Fix lack of NUL-termination in to_upper/to_lower BIF's return val.
This commit is contained in:
parent
d2118200ea
commit
928baf4b66
2 changed files with 4 additions and 9 deletions
|
@ -192,10 +192,7 @@ function default_path_func(id: ID, path: string, rec: any) : string
|
||||||
output = cat(output, "_", module_parts[3]);
|
output = cat(output, "_", module_parts[3]);
|
||||||
if ( 4 in module_parts && module_parts[4] != "" )
|
if ( 4 in module_parts && module_parts[4] != "" )
|
||||||
output = cat(output, sub_bytes(module_parts[4],1,1), "_", sub_bytes(module_parts[4], 2, |module_parts[4]|));
|
output = cat(output, sub_bytes(module_parts[4],1,1), "_", sub_bytes(module_parts[4], 2, |module_parts[4]|));
|
||||||
# TODO: There seems to be some problem with the split function
|
return to_lower(output);
|
||||||
# not putting \0 at the end of the string. fmt will make
|
|
||||||
# a better internal string.
|
|
||||||
return fmt("%s", to_lower(output));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Example: Notice::POLICY_LOG -> "notice_policy"
|
# Example: Notice::POLICY_LOG -> "notice_policy"
|
||||||
|
@ -206,9 +203,7 @@ function default_path_func(id: ID, path: string, rec: any) : string
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
# In case there is a logging stream in the global namespace.
|
return to_lower(id_str);
|
||||||
# TODO: same bug as above with split and lack of terminating \0
|
|
||||||
return fmt("%s", to_lower(id_str));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -493,7 +493,7 @@ function to_lower%(str: string%): string
|
||||||
*ls++ = s[i];
|
*ls++ = s[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
return new StringVal(new BroString(1, byte_vec(lower_s), n));
|
return new StringVal(n, lower_s);
|
||||||
%}
|
%}
|
||||||
|
|
||||||
function to_upper%(str: string%): string
|
function to_upper%(str: string%): string
|
||||||
|
@ -511,7 +511,7 @@ function to_upper%(str: string%): string
|
||||||
*us++ = s[i];
|
*us++ = s[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
return new StringVal(new BroString(1, byte_vec(upper_s), n));
|
return new StringVal(n, upper_s);
|
||||||
%}
|
%}
|
||||||
|
|
||||||
function clean%(str: string%): string
|
function clean%(str: string%): string
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue