mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arthur Gautier <baloo@gandi.net>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: linux-kernel@vger.kernel.org, Arthur Gautier <baloo@gandi.net>
Subject: [PATCH] param: fixup quote parsing of kernel arguments
Date: Tue,  7 Apr 2015 13:20:35 +0200	[thread overview]
Message-ID: <1428405635-8231-1-git-send-email-baloo@gandi.net> (raw)

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


             reply	other threads:[~2015-04-07 11:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-07 11:20 Arthur Gautier [this message]
2015-04-08  5:59 ` Rusty Russell
2015-04-08  9:44   ` Arthur Gautier
2015-04-15  0:54     ` Rusty Russell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1428405635-8231-1-git-send-email-baloo@gandi.net \
    --to=baloo@gandi.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®