]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
container.conf: Fix off by 2 in option parsing
authorMaximilian Blenk <Maximilian.Blenk@bmw.de>
Wed, 5 Feb 2020 18:17:51 +0000 (19:17 +0100)
committerMaximilian Blenk <Maximilian.Blenk@bmw.de>
Wed, 5 Feb 2020 18:18:25 +0000 (19:18 +0100)
This commit fixes a off by 2 in config option parsing
(due to missing parenthesis). The error occurs if for instance
lxc.net.0.type is parsed. In that case, the .0 is removed from the
string. However, due to the missing parenthesis, the null terminating
character is off by two which means the modified config option would
be lxc.net.typepe instead of lxc.net.type.

Signed-off-by: Maximilian Blenk <Maximilian.Blenk@bmw.de>
src/lxc/confile.c

index ae28163bb108010a6e268e3849ca935a728803cd..e52072ee8103644c6ca463624cfe288bcd097a3f 100644 (file)
@@ -4929,7 +4929,7 @@ static struct lxc_config_t *get_network_config_ops(const char *key,
                }
 
                memmove(copy + 8, idx_end + 1, strlen(idx_end + 1));
-               copy[strlen(key) - numstrlen + 1] = '\0';
+               copy[strlen(key) - (numstrlen + 1)] = '\0';
 
                config = lxc_get_config(copy);
                if (!config) {