]> git.ipfire.org Git - thirdparty/lxc.git/commit
Fix start api call to split quoted strings in execute or init command. 4336/head
authorScott Moser <smoser@brickies.net>
Tue, 22 Aug 2023 18:07:36 +0000 (14:07 -0400)
committerScott Moser <smoser@brickies.net>
Tue, 22 Aug 2023 20:50:45 +0000 (16:50 -0400)
commit3f45443fd03e7ea82a98691888802cdf1d011bd1
tree05dd0054053bdc7715713cba049a02a0787460f7
parent2ec7dd38b835219a72540ff5ca61f4eee07d590a
Fix start api call to split quoted strings in execute or init command.

If a user of the container.start api call provided NULL for the argv
argument, then lxc would load either 'lxc.execute.cmd' or
'lxc.init.cmd' configuration items as the command.

Given a config like:

    lxc.execute.cmd = /usr/bin/touch "file one" "file 2"

lxc would just split the string on spaces and end up executing array:

  ['touch', 'file"', 'one"', '"file', '2"']

This differs from the experience with the `lxc-start` command which
would use lxc_string_split_quoted and execute:

  ['touch', 'file one', 'file 2']

Note that as described in lxc_string_split_quoted, commands that include
nested quotes and possibly other characters are still a problem.  In
those cases, the caller of 'start' can provide an argv array.

Signed-off-by: Scott Moser <smoser@brickies.net>
src/lxc/lxccontainer.c