From c750dbfc588963ce739e14256048c90f66458076 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Fri, 27 Nov 2020 20:22:15 +0100 Subject: 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. --- libdiskfs/dir-lookup.c | 8 ++------ 1 file 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); -- cgit v1.2.3