From: Rusty Russell Date: Wed, 15 Apr 2015 03:53:48 +0000 (+0930) Subject: params: handle quotes properly for values not of form foo="bar". X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b9cc4489c68de59f7a38ef4e02a9829465a6a544;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git params: handle quotes properly for values not of form foo="bar". 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"' Reported-by: Arthur Gautier Signed-off-by: Rusty Russell --- diff --git a/kernel/params.c b/kernel/params.c index 728e05b167de..a22d6a759b1a 100644 --- a/kernel/params.c +++ b/kernel/params.c @@ -173,9 +173,9 @@ static char *next_arg(char *args, char **param, char **val) if (args[i-1] == '"') args[i-1] = '\0'; } - if (quoted && args[i-1] == '"') - args[i-1] = '\0'; } + if (quoted && args[i-1] == '"') + args[i-1] = '\0'; if (args[i]) { args[i] = '\0';