Reviewed-by: Ruiyu Ni <ruiyu...@intel.com> Thanks/Ray
> -----Original Message----- > From: edk2-devel <edk2-devel-boun...@lists.01.org> On Behalf Of > jim.dai...@dell.com > Sent: Saturday, October 6, 2018 3:15 AM > To: edk2-devel@lists.01.org > Cc: Kinney, Michael D <michael.d.kin...@intel.com>; Gao, Liming > <liming....@intel.com> > Subject: [edk2] [PATCH] MdePkg-BaseLib: Fix PathCleanUpDirectories() issue > with "\\..\\.." > > Replace multiple, consecutive "\" characters prior to other processing > involving "\" characters. This fixes an issue where "\\..\\..", "//..//..", > and > similar input paths are not cleaned properly. > > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Jim Dailey <jim_dai...@dell.com> > --- > MdePkg/Library/BaseLib/FilePaths.c | 15 ++++++++------- > 1 file changed, 8 insertions(+), 7 deletions(-) > > diff --git a/MdePkg/Library/BaseLib/FilePaths.c > b/MdePkg/Library/BaseLib/FilePaths.c > index d6f3758ecb..c5ca0a3b77 100644 > --- a/MdePkg/Library/BaseLib/FilePaths.c > +++ b/MdePkg/Library/BaseLib/FilePaths.c > @@ -2,6 +2,7 @@ > Defines file-path manipulation functions. > > Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR> > + Copyright (c) 2018, Dell Technologies. All rights reserved.<BR> > This program and the accompanying materials > are licensed and made available under the terms and conditions of the BSD > License > which accompanies this distribution. The full text of the license may be > found at @@ -85,6 +86,13 @@ PathCleanUpDirectories( > } > } > > + // > + // Replace the "\\" with "\" > + // > + while ((TempString = StrStr (Path, L"\\\\")) != NULL) { > + CopyMem (TempString, TempString + 1, StrSize (TempString + 1)); } > + > // > // Remove all the "\.". E.g.: fs0:\abc\.\def\. > // > @@ -106,13 +114,6 @@ PathCleanUpDirectories( > CopyMem (Path + StrLen (Path), TempString + 3, StrSize (TempString + 3)); > } > > - // > - // Replace the "\\" with "\" > - // > - while ((TempString = StrStr (Path, L"\\\\")) != NULL) { > - CopyMem (TempString, TempString + 1, StrSize (TempString + 1)); > - } > - > return Path; > } > > -- > 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