Skip to content

Commit

Permalink
params: handle quotes properly for values not of form foo="bar".
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell committed Apr 15, 2015
1 parent e5d8f59 commit b9cc448
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kernel/params.c
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down

0 comments on commit b9cc448

Please sign in to comment.