Re: [edk2] [PATCH] MdePkg-BaseLib: PathCleanUpDirectories fix
Liming and Mike, I don't feel there is any logical issue with this proposed fix. However, there is some shell code that fails when the fix is in place. I think that shell code probably should be changed; I'll see if I can make an acceptable change there first. Please disregard this patch; I'll likely resubmit some version of it later on. Regards, Jim -Original Message- From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Dailey, Jim Sent: Friday, November 30, 2018 9:43 AM To: liming@intel.com; michael.d.kin...@intel.com Cc: edk2-devel@lists.01.org Subject: Re: [edk2] [PATCH] MdePkg-BaseLib: PathCleanUpDirectories fix [EXTERNAL EMAIL] Oops! I think this change may have an issue. Hold off and I'll let you know if that's the case. --Jim -Original Message- From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Dailey, Jim Sent: Friday, November 30, 2018 9:12 AM To: liming@intel.com; michael.d.kin...@intel.com Cc: edk2-devel@lists.01.org Subject: [edk2] [PATCH] MdePkg-BaseLib: PathCleanUpDirectories fix PathCleanUpDirectories does not handle "\..\" properly; it returns "\" instead of "". This change fixes that problem so that "" is returned. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jim Dailey --- MdePkg/Library/BaseLib/FilePaths.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/MdePkg/Library/BaseLib/FilePaths.c b/MdePkg/Library/BaseLib/FilePaths.c index 92e4c350ff..69e46dd135 100644 --- a/MdePkg/Library/BaseLib/FilePaths.c +++ b/MdePkg/Library/BaseLib/FilePaths.c @@ -110,7 +110,12 @@ PathCleanUpDirectories( ((*(TempString + 3) == L'\\') || (*(TempString + 3) == CHAR_NULL)) ) { *(TempString + 1) = CHAR_NULL; -PathRemoveLastItem(Path); +if (!PathRemoveLastItem(Path)) { + // + // We had "\.." + // + *Path = CHAR_NULL; +} if (*(TempString + 3) != CHAR_NULL) { CopyMem (Path + StrLen (Path), TempString + 4, StrSize (TempString + 4)); } -- 2.17.0.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH] MdePkg-BaseLib: PathCleanUpDirectories fix
Oops! I think this change may have an issue. Hold off and I'll let you know if that's the case. --Jim -Original Message- From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Dailey, Jim Sent: Friday, November 30, 2018 9:12 AM To: liming@intel.com; michael.d.kin...@intel.com Cc: edk2-devel@lists.01.org Subject: [edk2] [PATCH] MdePkg-BaseLib: PathCleanUpDirectories fix PathCleanUpDirectories does not handle "\..\" properly; it returns "\" instead of "". This change fixes that problem so that "" is returned. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jim Dailey --- MdePkg/Library/BaseLib/FilePaths.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/MdePkg/Library/BaseLib/FilePaths.c b/MdePkg/Library/BaseLib/FilePaths.c index 92e4c350ff..69e46dd135 100644 --- a/MdePkg/Library/BaseLib/FilePaths.c +++ b/MdePkg/Library/BaseLib/FilePaths.c @@ -110,7 +110,12 @@ PathCleanUpDirectories( ((*(TempString + 3) == L'\\') || (*(TempString + 3) == CHAR_NULL)) ) { *(TempString + 1) = CHAR_NULL; -PathRemoveLastItem(Path); +if (!PathRemoveLastItem(Path)) { + // + // We had "\.." + // + *Path = CHAR_NULL; +} if (*(TempString + 3) != CHAR_NULL) { CopyMem (Path + StrLen (Path), TempString + 4, StrSize (TempString + 4)); } -- 2.17.0.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH] MdePkg-BaseLib: PathCleanUpDirectories fix
PathCleanUpDirectories does not handle "\..\" properly; it returns "\" instead of "". This change fixes that problem so that "" is returned. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jim Dailey --- MdePkg/Library/BaseLib/FilePaths.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/MdePkg/Library/BaseLib/FilePaths.c b/MdePkg/Library/BaseLib/FilePaths.c index 92e4c350ff..69e46dd135 100644 --- a/MdePkg/Library/BaseLib/FilePaths.c +++ b/MdePkg/Library/BaseLib/FilePaths.c @@ -110,7 +110,12 @@ PathCleanUpDirectories( ((*(TempString + 3) == L'\\') || (*(TempString + 3) == CHAR_NULL)) ) { *(TempString + 1) = CHAR_NULL; -PathRemoveLastItem(Path); +if (!PathRemoveLastItem(Path)) { + // + // We had "\.." + // + *Path = CHAR_NULL; +} if (*(TempString + 3) != CHAR_NULL) { CopyMem (Path + StrLen (Path), TempString + 4, StrSize (TempString + 4)); } -- 2.17.0.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel