Commit 76b03fe4 authored by Flavio Ceolin's avatar Flavio Ceolin Committed by Josh Lilly
Browse files

fs: fuse: Avoid possible buffer overflow

Checks path's size before copying it to local variable.

Signed-off-by: default avatarFlavio Ceolin <flavio.ceolin@intel.com>
(cherry picked from commit 3267bdc4)
parent 4826bc15
Loading
Loading
Loading
Loading
+8 −1
Changes for subsys/fs/fuse_fs_access.c: 8 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -65,8 +65,15 @@ static void release_file_handle(size_t handle)
static bool is_mount_point(const char *path)
{
	char dir_path[PATH_MAX];
	size_t len;

	sprintf(dir_path, "%s", path);
	len = strlen(path);
	if (len >=  sizeof(dir_path)) {
		return false;
	}

	memcpy(dir_path, path, len);
	dir_path[len] = '\0';
	return strcmp(dirname(dir_path), "/") == 0;
}