diff --git a/ShellPkg/Application/Shell/ShellProtocol.c b/ShellPkg/Application/Shell/ShellProtocol.c index 392298989e..0f799786ee 100644 --- a/ShellPkg/Application/Shell/ShellProtocol.c +++ b/ShellPkg/Application/Shell/ShellProtocol.c @@ -386,6 +386,7 @@ EfiShellGetFilePathFromDevicePath( EFI_HANDLE MapHandle; EFI_STATUS Status; FILEPATH_DEVICE_PATH *FilePath; + FILEPATH_DEVICE_PATH *AlignedNode; PathForReturn = NULL; PathSize = 0; @@ -436,7 +437,10 @@ EfiShellGetFilePathFromDevicePath( // ASSERT((PathForReturn == NULL && PathSize == 0) || (PathForReturn != NULL)); PathForReturn = StrnCatGrow(&PathForReturn, &PathSize, L"\\", 1); - PathForReturn = StrnCatGrow(&PathForReturn, &PathSize, FilePath->PathName, 0); + + AlignedNode = AllocateCopyPool (DevicePathNodeLength(FilePath), FilePath); + PathForReturn = StrnCatGrow(&PathForReturn, &PathSize, AlignedNode->PathName, 0); + FreePool(AlignedNode); } } // for loop of remaining nodes }