zeek/testing/btest/bifs/to_port.zeek
Arne Welzel c89be2a13b bifs/to_port: Avoid ASAN errors when calling to_port("")
Ran into this when using to_port(getenv(...)) for an undefined/empty
environment variable. ASAN doesn't like that the slash variable ends
up being access behind the string.
2022-08-31 17:15:50 +02:00

24 lines
536 B
Text

#
# @TEST-EXEC: zeek -b %INPUT >out
# @TEST-EXEC: btest-diff out
event zeek_init()
{
print to_port("123/tcp");
print to_port("123/udp");
print to_port("123/icmp");
print to_port("0/tcp");
print to_port("0/udp");
print to_port("0/icmp");
print to_port("not a port");
print to_port("");
print to_port("123");
print to_port("123/");
local a: transport_proto = tcp;
local b: transport_proto = udp;
local c: transport_proto = icmp;
print count_to_port(256, a);
print count_to_port(256, b);
print count_to_port(256, c);
}