diff --git a/reactos/lib/rtl/path.c b/reactos/lib/rtl/path.c index fff0e8aecea..5d8d197e07d 100644 --- a/reactos/lib/rtl/path.c +++ b/reactos/lib/rtl/path.c @@ -596,6 +596,7 @@ RtlpDosPathNameToRelativeNtPathName_Ustr(IN BOOLEAN HaveRelative, if (cd->Handle) { RtlInitUnicodeString(&us, Buffer); + us.Length = (cd->DosPath.Length < us.Length) ? cd->DosPath.Length : us.Length; if (RtlEqualUnicodeString(&us, &cd->DosPath, TRUE)) { Length = ((cd->DosPath.Length / sizeof(WCHAR)) - PrefixCut) + ((InputPathType == 1) ? 8 : 4);