CHROOT - fix symbolic link that refers to a network share (#596)

This commit is contained in:
bagajjal 2022-04-15 13:49:41 -07:00 committed by GitHub
parent 4833ddaeb8
commit cf06f991f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -46,5 +46,4 @@ try
finally
{
Pop-Location
}
}

View File

@ -427,6 +427,14 @@ file_in_chroot_jail(HANDLE handle) {
if (!final_path)
return 0;
const wchar_t* uncPrefix = L"UNC\\";
int isUNCPath = memcmp(final_path, uncPrefix, 2 * wcslen(uncPrefix));
if (0 == isUNCPath) {
debug3("symlink points to UNCPath");
return 1;
}
to_wlower_case(final_path);
if ((wcslen(final_path) < wcslen(chroot_pathw)) ||
memcmp(final_path, chroot_pathw, 2 * wcslen(chroot_pathw)) != 0 ||