]> 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>
Mon, 29 Mar 2021 15:02:33 +0000 (17:02 +0200)
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 9ff8f90f661804da2333a457c268265885605476..d6d77ab5eeda20f9b0c252f859c7ba8c04a52c13 100644 (file)
@@ -4759,6 +4759,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';