Message ID | 20241126184156.12503-1-zichenxie0106@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | samples/landlock: Fix possible NULL dereference in parse_path() | expand |
diff --git a/samples/landlock/sandboxer.c b/samples/landlock/sandboxer.c index 57565dfd74a2..385fc115647f 100644 --- a/samples/landlock/sandboxer.c +++ b/samples/landlock/sandboxer.c @@ -91,6 +91,9 @@ static int parse_path(char *env_path, const char ***const path_list) } } *path_list = malloc(num_paths * sizeof(**path_list)); + if (*path_list == NULL) + return 1; + for (i = 0; i < num_paths; i++) (*path_list)[i] = strsep(&env_path, ENV_DELIMITER);