Commit d013132f authored by Flavio Ceolin's avatar Flavio Ceolin Committed by Chris Friedt
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 25398f36
Loading
Loading
Loading
Loading
+8 −1
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;
}