mirror of
https://git.code.sf.net/p/ntfs-3g/ntfs-3g.git
synced 2024-11-30 13:33:57 +08:00
Fixed checking for writeable parent directory when truncating a file
This commit is contained in:
parent
370b73adb5
commit
fbadbb14b8
@ -779,10 +779,12 @@ static int ntfs_fuse_truncate(const char *org_path, off_t size)
|
||||
na = ntfs_attr_open(ni, AT_DATA, stream_name, stream_name_len);
|
||||
if (!na)
|
||||
goto exit;
|
||||
|
||||
/* JPA deny truncation if cannot write to file or parent directory */
|
||||
/*
|
||||
* JPA deny truncation if cannot write to file
|
||||
* or search in parent directory
|
||||
*/
|
||||
if (ntfs_fuse_fill_security_context(&security)
|
||||
&& (!ntfs_allowed_dir_access(&security, path, S_IWRITE + S_IEXEC)
|
||||
&& (!ntfs_allowed_dir_access(&security, path, S_IEXEC)
|
||||
|| !ntfs_allowed_access(&security, path, ni, S_IWRITE))) {
|
||||
errno = EACCES;
|
||||
ntfs_attr_close(na);
|
||||
|
Loading…
Reference in New Issue
Block a user