mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
GH-1245: require TLD of hostname literals to start with a letter
This commit is contained in:
parent
06191390c3
commit
fb85a19fa8
4 changed files with 16 additions and 1 deletions
|
@ -142,6 +142,7 @@ FILE [^ \t\n]+
|
||||||
PREFIX [^ \t\n]+
|
PREFIX [^ \t\n]+
|
||||||
FLOAT (({D}*"."?{D})|({D}"."?{D}*))([eE][-+]?{D})?
|
FLOAT (({D}*"."?{D})|({D}"."?{D}*))([eE][-+]?{D})?
|
||||||
H [A-Za-z0-9][A-Za-z0-9\-]*
|
H [A-Za-z0-9][A-Za-z0-9\-]*
|
||||||
|
HTLD [A-Za-z][A-Za-z0-9\-]*
|
||||||
ESCSEQ (\\([^\n]|[0-7]+|x[[:xdigit:]]+))
|
ESCSEQ (\\([^\n]|[0-7]+|x[[:xdigit:]]+))
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
@ -502,7 +503,7 @@ F RET_CONST(zeek::val_mgr->False()->Ref())
|
||||||
|
|
||||||
"0x"{HEX}+ RET_CONST(zeek::val_mgr->Count(static_cast<bro_uint_t>(strtoull(yytext, 0, 16))).release())
|
"0x"{HEX}+ RET_CONST(zeek::val_mgr->Count(static_cast<bro_uint_t>(strtoull(yytext, 0, 16))).release())
|
||||||
|
|
||||||
{H}("."{H})+ RET_CONST(zeek::detail::dns_mgr->LookupHost(yytext).release())
|
({H}".")+{HTLD} RET_CONST(zeek::detail::dns_mgr->LookupHost(yytext).release())
|
||||||
|
|
||||||
\"([^\\\n\"]|{ESCSEQ})*\" {
|
\"([^\\\n\"]|{ESCSEQ})*\" {
|
||||||
const char* text = yytext;
|
const char* text = yytext;
|
||||||
|
|
2
testing/btest/Baseline/language.invalid-hostnames-2/out
Normal file
2
testing/btest/Baseline/language.invalid-hostnames-2/out
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||||
|
error in <...>/invalid-hostnames.zeek, line 4: syntax error, at or near "f"
|
2
testing/btest/Baseline/language.invalid-hostnames/out
Normal file
2
testing/btest/Baseline/language.invalid-hostnames/out
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||||
|
error in <...>/invalid-hostnames.zeek, line 4: unknown identifier print0, at or near "print0"
|
10
testing/btest/language/invalid-hostnames.zeek
Normal file
10
testing/btest/language/invalid-hostnames.zeek
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
# @TEST-EXEC-FAIL: zeek -b %INPUT >out 2>&1
|
||||||
|
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff out
|
||||||
|
|
||||||
|
print0.0000000000005;
|
||||||
|
|
||||||
|
# @TEST-START-NEXT
|
||||||
|
|
||||||
|
# This is not a floating-point literal (like you'd see in C/C++) and it's
|
||||||
|
# also not a valid hostname since the TLD does not start with a letter.
|
||||||
|
print 0.05f;
|
Loading…
Add table
Add a link
Reference in a new issue