Skip to content

Commit b9cc448

Browse files
committed
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 <baloo@gandi.net> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
1 parent e5d8f59 commit b9cc448

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎kernel/params.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,9 @@ static char *next_arg(char *args, char **param, char **val)
173173
if (args[i-1] == '"')
174174
args[i-1] = '\0';
175175
}
176-
if (quoted && args[i-1] == '"')
177-
args[i-1] = '\0';
178176
}
177+
if (quoted && args[i-1] == '"')
178+
args[i-1] = '\0';
179179

180180
if (args[i]) {
181181
args[i] = '\0';

0 commit comments

Comments
 (0)