]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
confile: prevent recursion when parsing networks
authorChristian Brauner <christian.brauner@ubuntu.com>
Sat, 27 Mar 2021 13:31:50 +0000 (14:31 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Sat, 27 Mar 2021 13:31:50 +0000 (14:31 +0100)
Link: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=32558
Link: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=32484
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/confile.c

index 44e2ae66face91e2e695903a446735fca39e0ee5..3c5cb90603b896c5c06fb8424878001340fb0069 100644 (file)
@@ -5229,6 +5229,8 @@ static struct lxc_config_t *get_network_config_ops(const char *key,
                *idx_end = '.';
                if (strlen(idx_end + 1) == 0)
                        return log_error_errno(NULL, EINVAL, "No subkey in network configuration key \"%s\"", key);
+               if (isdigit(*(idx_end + 1)))
+                       return log_error_errno(NULL, EINVAL, "Key can't contain more than one index");
 
                memmove(copy + STRLITERALLEN("lxc.net."), idx_end + 1, strlen(idx_end + 1));
                copy[strlen(key) - (numstrlen + 1)] = '\0';