summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2020-11-27 20:22:15 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2020-11-27 20:22:15 +0100
commitc750dbfc588963ce739e14256048c90f66458076 (patch)
tree00651affc6f823ff2b589293a96637e6ae68f002
parentba5fabf334af2ebf6fb07910059517ae0569948e (diff)
libdiskfs: do not reuse pathbuf
When deadling with multiple levels of symlinks, we really need double buffering between the current path and the symlink target, and thus cannot reuse pathbuf. * libdiskfs/dir-lookup.c (diskfs_S_dir_lookup): Always use alloca for pathbuf.
-rw-r--r--libdiskfs/dir-lookup.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/libdiskfs/dir-lookup.c b/libdiskfs/dir-lookup.c
index 16eb22e3..f005dd86 100644
--- a/libdiskfs/dir-lookup.c
+++ b/libdiskfs/dir-lookup.c
@@ -46,7 +46,6 @@ diskfs_S_dir_lookup (struct protid *dircred,
int nextnamelen;
error_t err = 0;
char *pathbuf = 0;
- int pathbuflen = 0;
int newnamelen;
int create, excl;
int lastcomp = 0;
@@ -361,11 +360,8 @@ diskfs_S_dir_lookup (struct protid *dircred,
nextnamelen = nextname ? strlen (nextname) + 1 : 0;
newnamelen = nextnamelen + np->dn_stat.st_size + 1 + 1;
- if (pathbuflen < newnamelen)
- {
- pathbuf = alloca (newnamelen);
- pathbuflen = newnamelen;
- }
+
+ pathbuf = alloca (newnamelen);
if (diskfs_read_symlink_hook)
err = (*diskfs_read_symlink_hook)(np, pathbuf);