projects
/
linux-block.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
67c3a0b
)
coredump: validate that path doesn't exceed UNIX_PATH_MAX
author
Christian Brauner
<brauner@kernel.org>
Thu, 12 Jun 2025 13:25:18 +0000
(15:25 +0200)
committer
Christian Brauner
<brauner@kernel.org>
Mon, 16 Jun 2025 15:01:22 +0000
(17:01 +0200)
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>
fs/coredump.c
patch
|
blob
|
blame
|
history
diff --git
a/fs/coredump.c
b/fs/coredump.c
index 70e37435eca956f338fd0ed3f6d60da18f0d3b73..a64b87878ab37e917132e536fddd1a608f51340f 100644
(file)
--- a/
fs/coredump.c
+++ b/
fs/coredump.c
@@
-1388,6
+1388,8
@@
void validate_coredump_safety(void)
static inline bool check_coredump_socket(void)
{
+ const char *p;
+
if (core_pattern[0] != '@')
return true;
@@
-1407,10
+1409,15
@@
static inline bool check_coredump_socket(void)
/* ... and if so must be an absolute path. */
if (core_pattern[2] != '/')
return false;
- /* Anything else is unsupported. */
- return false;
+ p = &core_pattern[2];
+ } else {
+ p = &core_pattern[1];
}
+ /* The path obviously cannot exceed UNIX_PATH_MAX. */
+ if (strlen(p) >= UNIX_PATH_MAX)
+ return false;
+
return true;
}