* mono-path.c (mono_path_canonicalize): Properly canonicalize
non UNC paths with an extra backslash. Eg:
c:\foo\\bar was been canonicalized to c:\\foo\bar.
This was breaking assembly loading in some rare cases.
pos = strchr (lastpos, G_DIR_SEPARATOR);
}
-#ifdef HOST_WIN32 /* For UNC paths the first '\' is removed. */
- if (*(lastpos-1) == G_DIR_SEPARATOR && *(lastpos-2) == G_DIR_SEPARATOR)
+#ifdef HOST_WIN32
+ /* Avoid removing the first '\' for UNC paths. We must make sure that it's indeed an UNC path
+ by checking if the \\ pair happens exactly at the end of the string.
+ */
+ if (*(lastpos-1) == G_DIR_SEPARATOR && *(lastpos-2) == G_DIR_SEPARATOR && *lastpos == 0)
lastpos = lastpos-1;
#endif