fs: fuse: Avoid possible buffer overflow
Checks path's size before copying it to local variable. Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
parent
9c3ca4573a
commit
3267bdc4b7
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue