[apparmor] fix: pass through escape sequences that result in aare special chars

John Johansen john.johansen at canonical.com
Thu Jun 19 20:20:11 UTC 2014


On 06/19/2014 12:28 PM, John Johansen wrote:
> fix: pass through escape sequences that result in aare special chars
> 
Ooops the original had some pcre special chars instead of aare special chars

fix: pass through escape sequences that result in aare special chars

escape sequences that result in special character that will be interpreted
by later processing need to be passed through as well.

Eg. previously \\ was fixed to be passed through, but other chars
get interpretted as well.

*?[]{}
and ^, in character classes

Signed-off-by: John Johansen <john.johansen at canonical.com>
---
 parser/parser_misc.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

--- 2.9-test.orig/parser/parser_misc.c
+++ 2.9-test/parser/parser_misc.c
@@ -459,12 +459,13 @@
 		long c;
 		if (*string == '\\' && len > 1 &&
 		    (c = strn_escseq(&pos, "", len)) != -1) {
-			/* catch \\ or \134 and pass it through to be handled
-			 * by the backend pcre conversion
+			/* catch \\ or \134 and other aare special chars and
+			 * pass it through to be handled by the backend
+			 * pcre conversion
 			 */
-			if (c == '\\') {
-				*s++ = '\\';
+			if (strchr("*?[]{}^,\\", c) != NULL) {
 				*s++ = '\\';
+				*s++ = c;
 			} else
 				*s++ = c;
 			len -= pos - string;




More information about the AppArmor mailing list