mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-29 13:28:19 +00:00
Merge from trunk revision 1572: This patch fixes the parser's lexer to
not passthrough other invalid characters in variable declarations. It also adds testcases demonstrating the issue. Nominated-By: Steve Beattie <sbeattie@ubuntu.com>
This commit is contained in:
parent
d7e06b79bb
commit
c1a11fb8b6
@ -390,6 +390,11 @@ LT_EQUAL <=
|
|||||||
current_lineno++;
|
current_lineno++;
|
||||||
BEGIN(INITIAL);
|
BEGIN(INITIAL);
|
||||||
}
|
}
|
||||||
|
[^\n] {
|
||||||
|
DUMP_PREPROCESS;
|
||||||
|
/* Something we didn't expect */
|
||||||
|
yyerror(_("Found unexpected character: '%s'"), yytext);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
<NETWORK_MODE>{
|
<NETWORK_MODE>{
|
||||||
|
10
parser/tst/simple_tests/vars/vars_bad_1.sd
Normal file
10
parser/tst/simple_tests/vars/vars_bad_1.sd
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#=DESCRIPTION trailing garbage should trigger an error
|
||||||
|
#=EXRESULT FAIL
|
||||||
|
|
||||||
|
@{LIBVIRT} = "libvirt
|
||||||
|
|
||||||
|
/does/not/exist {
|
||||||
|
|
||||||
|
change_profile ->
|
||||||
|
@{LIBVIRT}-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*,
|
||||||
|
}
|
10
parser/tst/simple_tests/vars/vars_bad_2.sd
Normal file
10
parser/tst/simple_tests/vars/vars_bad_2.sd
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#=DESCRIPTION garbage should trigger an error
|
||||||
|
#=EXRESULT FAIL
|
||||||
|
|
||||||
|
@{LIBVIRT} = lib"virt
|
||||||
|
|
||||||
|
/does/not/exist {
|
||||||
|
|
||||||
|
change_profile ->
|
||||||
|
@{LIBVIRT}-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*,
|
||||||
|
}
|
10
parser/tst/simple_tests/vars/vars_bad_3.sd
Normal file
10
parser/tst/simple_tests/vars/vars_bad_3.sd
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#=DESCRIPTION garbage should trigger an error
|
||||||
|
#=EXRESULT FAIL
|
||||||
|
|
||||||
|
@{LIBVIRT} = lib!virt libfail
|
||||||
|
|
||||||
|
/does/not/exist {
|
||||||
|
|
||||||
|
change_profile ->
|
||||||
|
@{LIBVIRT}-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*,
|
||||||
|
}
|
10
parser/tst/simple_tests/vars/vars_bad_trailing_garbage_1.sd
Normal file
10
parser/tst/simple_tests/vars/vars_bad_trailing_garbage_1.sd
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#=DESCRIPTION trailing garbage should trigger an error
|
||||||
|
#=EXRESULT FAIL
|
||||||
|
|
||||||
|
@{LIBVIRT} = libvirt"
|
||||||
|
|
||||||
|
/does/not/exist {
|
||||||
|
|
||||||
|
change_profile ->
|
||||||
|
@{LIBVIRT}-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*,
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user