[apparmor] [patch 25/26] Fix garbage characters in -p profile preprocessing output

john.johansen at canonical.com john.johansen at canonical.com
Tue Apr 15 17:22:32 UTC 2014


apparmor_parser -p is broken. Outputting garbage charcters after every
include statement.

eg.

##included <tunables/multiarch>
^@^@V><A8>^?^@^@<C8>^NV><A8>^?^@^@<A0>^Pu^@# -----------------------------------
-------------------------------
#

This is happening because includes are handled specially and should not
go through the usual preprocessing output dump.

Signed-off-by: John Johansen <john.johansen at canonical.com>
Acked-by: Seth Arnold <seth.arnold at canonical.com>
---
 parser/parser_lex.l |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

--- 2.9-test.orig/parser/parser_lex.l
+++ 2.9-test/parser/parser_lex.l
@@ -80,6 +80,12 @@
 	yy_pop_state(); \
 } while (0)
 
+#define POP_NODUMP() \
+do { \
+	PDEBUG(" (pop_to(%s)): Matched: %s\n", state_names[yy_top_state()].c_str(), yytext); \
+	yy_pop_state(); \
+} while (0)
+
 #define PUSH(X) \
 do { \
 	DUMP_AND_DEBUG(" (push(%s)): Matched: %s\n", state_names[(X)].c_str(), yytext); \
@@ -278,12 +284,12 @@
 		char *filename = strndup(yytext, yyleng - 1);
 		include_filename(filename + 1, *filename == '<');
 		free(filename);
-		POP();
+		POP_NODUMP();
 	}
 
 	[^\<\>\" \t\n]+ {	/* filename */
 		include_filename(yytext, 0);
-		POP();
+		POP_NODUMP();
 	}
 }
 




More information about the AppArmor mailing list