Reviewed-by: Ruiyu Ni <[email protected]>

Thanks/Ray

> -----Original Message-----
> From: edk2-devel <[email protected]> On Behalf Of
> [email protected]
> Sent: Saturday, October 6, 2018 3:15 AM
> To: [email protected]
> Cc: Kinney, Michael D <[email protected]>; Gao, Liming
> <[email protected]>
> 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 <[email protected]>
> ---
>  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
> [email protected]
> https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to