public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] param: fixup quote parsing of kernel arguments
@ 2015-04-07 11:20 Arthur Gautier
  2015-04-08  5:59 ` Rusty Russell
  0 siblings, 1 reply; 4+ messages in thread
From: Arthur Gautier @ 2015-04-07 11:20 UTC (permalink / raw)
  To: Rusty Russell; +Cc: linux-kernel, Arthur Gautier

When starting kernel with arguments like:
  init=/bin/sh -c "echo arguments"
the trailing double quote is not removed which results in following command
being executed:
  /bin/sh -c 'echo arguments"'

This commit removes the trailing double quote.

Signed-off-by: Arthur Gautier <baloo@gandi.net>
---
 kernel/params.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/params.c b/kernel/params.c
index 728e05b..2118546 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -156,8 +156,11 @@ static char *next_arg(char *args, char **param, char **val)
 			if (args[i] == '=')
 				equals = i;
 		}
-		if (args[i] == '"')
+		if (args[i] == '"') {
+			if (!equals)
+				args[i] = '\0';
 			in_quote = !in_quote;
+		}
 	}
 
 	*param = args;
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-04-15  3:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-07 11:20 [PATCH] param: fixup quote parsing of kernel arguments Arthur Gautier
2015-04-08  5:59 ` Rusty Russell
2015-04-08  9:44   ` Arthur Gautier
2015-04-15  0:54     ` Rusty Russell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox