coredump: validate socket path in coredump_parse()

properly again. Someone might have modified the buffer concurrently.

Link: https://lore.kernel.org/20250612-work-coredump-massage-v1-7-315c0c34ba94@kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
Christian Brauner
2025-06-12 15:25:21 +02:00
parent edfe3bdbbb
commit 6dfc06d328
+11
View File
@@ -296,6 +296,17 @@ static bool coredump_parse(struct core_name *cn, struct coredump_params *cprm,
return false;
}
/* Must not contain ".." in the path. */
if (name_contains_dotdot(cn->corename)) {
coredump_report_failure("Coredump socket may not %s contain '..' spaces", cn->corename);
return false;
}
if (strlen(cn->corename) >= UNIX_PATH_MAX) {
coredump_report_failure("Coredump socket path %s too long", cn->corename);
return false;
}
/*
* Currently no need to parse any other options.
* Relevant information can be retrieved from the peer