lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 30 Aug 2022 09:51:25 +0200
From:   Rasmus Villemoes <linux@...musvillemoes.dk>
To:     Kent Overstreet <kent.overstreet@...ux.dev>,
        linux-kernel@...r.kernel.org
Cc:     Petr Mladek <pmladek@...e.com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Sergey Senozhatsky <senozhatsky@...omium.org>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Rasmus Villemoes <linux@...musvillemoes.dk>
Subject: Re: [PATCH 2/2] lib/test_printf.c: Add escaped string tests

On 30/08/2022 02.31, Kent Overstreet wrote:
> This adds missing tests for %pE, escaped strings.
> 
> Signed-off-by: Kent Overstreet <kent.overstreet@...ux.dev>
> Cc: Petr Mladek <pmladek@...e.com>
> Cc: Steven Rostedt <rostedt@...dmis.org>
> Cc: Sergey Senozhatsky <senozhatsky@...omium.org>
> Cc: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> Cc: Rasmus Villemoes <linux@...musvillemoes.dk>
> ---
>  lib/test_printf.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/lib/test_printf.c b/lib/test_printf.c
> index 6a56dbf076..247b1adbbe 100644
> --- a/lib/test_printf.c
> +++ b/lib/test_printf.c
> @@ -413,6 +413,21 @@ addr(void)
>  static void __init
>  escaped_str(void)
>  {
> +	const char buf[] = "test \f\n\r\t\v \"\\\a\e \0 end";
> +	unsigned n = strlen(buf), with_embedded_nul = sizeof(buf) - 1;
> +
> +	/* ESCAPE_ANY_NP: */
> +	test("test \\f\\n\\r\\t\\v \"\\\\a\\e ",	"%*pE",  n, buf);
> +	/* ESCAPE_ANY: */
> +	//test("test \\f\\n\\r\\t\\v \"\\\\a\\e end",	"%*pEa",  n, buf);

Is there a reason that one is commented out?

> +	/* ESCAPE_SPACE: */
> +	test("test \\f\\n\\r\\t\\v \"\\\x07\x1b ",	"%*pEs", n, buf);
> +
> +	/* ESCAPE_SPECIAL: */
> +	test("test \f\n\r\t\v \\\"\\\\\\a\\e ",		"%*pEc", n, buf);
> +
> +	/* ESCAPE_NULL: */
> +	test("test \f\n\r\t\v \"\\\a\e \\0 end",	"%*pEn", with_embedded_nul, buf);
>  }

Perhaps also include a few byte values >= 128. Otherwise looks good.

Rasmus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ