diff options
author | Damien Zammit <damien@zamaudio.com> | 2019-11-23 15:08:47 +1100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2019-11-24 20:30:27 +0100 |
commit | 6b1312cfbb77dfe338f56a71a8f5461ec135f47c (patch) | |
tree | 33be55115e217a18c30845c3c709896b46cbcaa3 /ext2fs | |
parent | 3b32a7ece09a4652a5fd6186aa059fd0e2163f5a (diff) | |
download | hurd-6b1312cfbb77dfe338f56a71a8f5461ec135f47c.tar.gz hurd-6b1312cfbb77dfe338f56a71a8f5461ec135f47c.tar.bz2 hurd-6b1312cfbb77dfe338f56a71a8f5461ec135f47c.zip |
ext2fs: Fix fast symlinks created by linux
linux seems to allocate 8 blocks for any fast symlink.
* ext2fs/inode.c (write_symlink): Do not assert that st_blocks is 0.
(read_symlink): Return EINVAL when node->dn_stat.st_size >=
MAX_INODE_SYMLINK, not when node->dn_stat.st_blocks != 0.
Diffstat (limited to 'ext2fs')
-rw-r--r-- | ext2fs/inode.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/ext2fs/inode.c b/ext2fs/inode.c index 472c1b43..d73d0bca 100644 --- a/ext2fs/inode.c +++ b/ext2fs/inode.c @@ -769,8 +769,6 @@ write_symlink (struct node *node, const char *target) if (len > MAX_INODE_SYMLINK) return EINVAL; - assert_backtrace (node->dn_stat.st_blocks == 0); - memcpy (diskfs_node_disknode (node)->info.i_data, target, len); node->dn_stat.st_size = len - 1; node->dn_set_ctime = 1; @@ -783,11 +781,9 @@ write_symlink (struct node *node, const char *target) static error_t read_symlink (struct node *node, char *target) { - if (node->dn_stat.st_blocks) + if (node->dn_stat.st_size >= MAX_INODE_SYMLINK) return EINVAL; - assert_backtrace (node->dn_stat.st_size < MAX_INODE_SYMLINK); - memcpy (target, diskfs_node_disknode (node)->info.i_data, node->dn_stat.st_size); return 0; |