[PATCH 04/24] coredump: validate that path doesn't exceed UNIX_PATH_MAX

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



so we don't pointlessly accepts things that go over the limit.

Signed-off-by: Christian Brauner <brauner@xxxxxxxxxx>
---
 fs/coredump.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/fs/coredump.c b/fs/coredump.c
index 70e37435eca9..a64b87878ab3 100644
--- 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;
 }
 

-- 
2.47.2





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux