]> wimlib.net Git - wimlib/blobdiff - src/win32_apply.c
win32_apply.c: explicitly remove extra slashes in link targets
[wimlib] / src / win32_apply.c
index 3a2c077dab34436c79732ac2be0e9ade33452b8b..a96fbd4b2ad0a87db774e962067a85f32c29de2b 100644 (file)
@@ -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];