From 33e8240edea55d28cd9bafae542f4d571459a181 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Wed, 10 Feb 2016 19:55:36 -0600 Subject: [PATCH] win32_apply.c: explicitly remove extra slashes in link targets --- src/win32_apply.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/win32_apply.c b/src/win32_apply.c index 3a2c077d..a96fbd4b 100644 --- a/src/win32_apply.c +++ b/src/win32_apply.c @@ -2120,6 +2120,15 @@ try_rpfix(struct reparse_buffer_disk *rpbuf, u16 *rpbuflen_p, ctx->target_ntpath.Buffer[target_ntpath_nchars - 1] == L'\\') target_ntpath_nchars--; + /* Also remove extra slashes from the beginning of 'relpath'. Normally + * this isn't needed, but this is here to make the extra slash(es) added + * by wimlib pre-v1.9.1 get removed automatically. */ + while (relpath_nchars >= 2 && + relpath[0] == L'\\' && relpath[1] == L'\\') { + relpath++; + relpath_nchars--; + } + fixed_subst_name_nchars = target_ntpath_nchars + relpath_nchars; wchar_t fixed_subst_name[fixed_subst_name_nchars]; -- 2.43.0