mirror of https://github.com/torvalds/linux.git
coredump: validate that path doesn't exceed UNIX_PATH_MAX
so we don't pointlessly accepts things that go over the limit. Link: https://lore.kernel.org/20250612-work-coredump-massage-v1-4-315c0c34ba94@kernel.org Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
parent
67c3a0b0ad
commit
3a2c977c46
|
|
@ -1388,6 +1388,8 @@ void validate_coredump_safety(void)
|
||||||
|
|
||||||
static inline bool check_coredump_socket(void)
|
static inline bool check_coredump_socket(void)
|
||||||
{
|
{
|
||||||
|
const char *p;
|
||||||
|
|
||||||
if (core_pattern[0] != '@')
|
if (core_pattern[0] != '@')
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
@ -1407,10 +1409,15 @@ static inline bool check_coredump_socket(void)
|
||||||
/* ... and if so must be an absolute path. */
|
/* ... and if so must be an absolute path. */
|
||||||
if (core_pattern[2] != '/')
|
if (core_pattern[2] != '/')
|
||||||
return false;
|
return false;
|
||||||
/* Anything else is unsupported. */
|
p = &core_pattern[2];
|
||||||
return false;
|
} else {
|
||||||
|
p = &core_pattern[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* The path obviously cannot exceed UNIX_PATH_MAX. */
|
||||||
|
if (strlen(p) >= UNIX_PATH_MAX)
|
||||||
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue