[apparmor] fix ${} not being treated as pcre special chars

John Johansen john.johansen at canonical.com
Thu Jun 19 19:09:00 UTC 2014


Fix: backend processing was not treating ${} as a special pcre character

Also for characters that are not recognized as a valid escape seq
make sure that the character is emitted.

previously
  \$ resulted in \
where it should have been \$ if $ wasn't recognized

Signed-off-by: John Johansen <john.johansen at canonical.com>
---
 parser/libapparmor_re/parse.y |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

--- 2.9-test.orig/parser/libapparmor_re/parse.y
+++ 2.9-test/parser/libapparmor_re/parse.y
@@ -172,14 +172,15 @@
 		return *(*pos - 1);
 
 	case '\\':
-		tmp = str_escseq(pos, "*+.|^-[]()");
-		if (tmp == -1)
+		tmp = str_escseq(pos, "*+.|^$-[](){}");
+		if (tmp == -1) {
 			/* bad escape sequence, just skip it for now, that
 			 * is output \\ followed by the invalid esc seq
 			 * TODO: output error message
 			 */
 			val->c = '\\';
-		else
+			(*pos)--;
+		} else
 			val->c = tmp;
 		break;
 	}



More information about the AppArmor mailing list