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:   Fri, 15 Dec 2017 22:49:41 +0100
From:   Michal Suchanek <msuchanek@...e.de>
To:     Hari Bathini <hbathini@...ux.vnet.ibm.com>,
        linuxppc-dev <linuxppc-dev@...abs.org>,
        lkml <linux-kernel@...r.kernel.org>,
        Ankit Kumar <ankit@...ux.vnet.ibm.com>,
        Mahesh J Salgaonkar <mahesh@...ux.vnet.ibm.com>
Cc:     Michal Suchanek <msuchanek@...e.de>
Subject: [PATCH] Optimize final quote removal.

This is additional patch that avoids the memmove when processing the quote on
the end of the parameter.

---
 lib/cmdline.c                                   | 9 +++++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/lib/cmdline.c b/lib/cmdline.c
index c5335a79a177..b1d8a0dc60fc 100644
--- a/lib/cmdline.c
+++ b/lib/cmdline.c
@@ -191,7 +191,13 @@ bool parse_option_str(const char *str, const char *option)
 	return false;
 }
 
+#define break_arg_end(i) { \
+	if (isspace(args[i]) && !in_quote && !backslash && !in_single) \
+		break; \
+	}
+
 #define squash_char { \
+	break_arg_end(i + 1); \
 	memmove(args + 1, args, i); \
 	args++; \
 	i--; \
@@ -209,8 +215,7 @@ char *next_arg(char *args, char **param, char **val)
 	char *next;
 
 	for (i = 0; args[i]; i++) {
-		if (isspace(args[i]) && !in_quote && !backslash && !in_single)
-			break;
+		break_arg_end(i);
 
 		if ((equals == 0) && (args[i] == '='))
 			equals = i;
-- 
2.13.6

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ