lkml.org 
[lkml]   [2015]   [Apr]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] Fixup quote parsing of kernel arguments
Date
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


\
 
 \ /
  Last update: 2015-04-02 17:01    [W:0.033 / U:0.520 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site