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

Steve Beattie steve at nxnw.org
Thu Jun 19 20:47:58 UTC 2014


On Thu, Jun 19, 2014 at 01:20:11PM -0700, John Johansen wrote:
> 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>
Acked-by: Steve Beattie <steve at nxnw.org>

> ---
>  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;
> 

-- 
Steve Beattie
<sbeattie at ubuntu.com>
http://NxNW.org/~steve/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20140619/d5347ac1/attachment.pgp>


More information about the AppArmor mailing list