Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753251AbbDGLVW (ORCPT ); Tue, 7 Apr 2015 07:21:22 -0400 Received: from mail4.gandi.net ([217.70.183.210]:51493 "EHLO gandi.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751075AbbDGLVV (ORCPT ); Tue, 7 Apr 2015 07:21:21 -0400 From: Arthur Gautier To: Rusty Russell Cc: linux-kernel@vger.kernel.org, Arthur Gautier Subject: [PATCH] param: fixup quote parsing of kernel arguments Date: Tue, 7 Apr 2015 13:20:35 +0200 Message-Id: <1428405635-8231-1-git-send-email-baloo@gandi.net> X-Mailer: git-send-email 2.1.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1021 Lines: 38 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 --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/