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:   Mon, 29 Aug 2022 20:31:19 -0400
From:   Kent Overstreet <kent.overstreet@...ux.dev>
To:     linux-kernel@...r.kernel.org
Cc:     Kent Overstreet <kent.overstreet@...ux.dev>,
        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: [PATCH 2/2] lib/test_printf.c: Add escaped string tests

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);
+	/* 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);
 }
 
 static void __init
-- 
2.36.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ