public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] MdePkg-BaseLib: Fix PathCleanUpDirectories() issue with "\\..\\.."
@ 2018-10-05 19:14 Jim.Dailey
  2018-10-24  4:42 ` Ni, Ruiyu
  0 siblings, 1 reply; 3+ messages in thread
From: Jim.Dailey @ 2018-10-05 19:14 UTC (permalink / raw)
  To: edk2-devel; +Cc: michael.d.kinney, liming.gao

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_dailey@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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] MdePkg-BaseLib: Fix PathCleanUpDirectories() issue with "\\..\\.."
  2018-10-05 19:14 [PATCH] MdePkg-BaseLib: Fix PathCleanUpDirectories() issue with "\\..\\.." Jim.Dailey
@ 2018-10-24  4:42 ` Ni, Ruiyu
  2018-10-24  4:44   ` Gao, Liming
  0 siblings, 1 reply; 3+ messages in thread
From: Ni, Ruiyu @ 2018-10-24  4:42 UTC (permalink / raw)
  To: Jim.Dailey@dell.com, edk2-devel@lists.01.org
  Cc: Kinney, Michael D, Gao, Liming

Reviewed-by: Ruiyu Ni <Ruiyu.ni@Intel.com>

Thanks/Ray

> -----Original Message-----
> From: edk2-devel <edk2-devel-bounces@lists.01.org> On Behalf Of
> Jim.Dailey@dell.com
> Sent: Saturday, October 6, 2018 3:15 AM
> To: edk2-devel@lists.01.org
> Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Gao, Liming
> <liming.gao@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_dailey@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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] MdePkg-BaseLib: Fix PathCleanUpDirectories() issue with "\\..\\.."
  2018-10-24  4:42 ` Ni, Ruiyu
@ 2018-10-24  4:44   ` Gao, Liming
  0 siblings, 0 replies; 3+ messages in thread
From: Gao, Liming @ 2018-10-24  4:44 UTC (permalink / raw)
  To: Ni, Ruiyu, Jim.Dailey@dell.com, edk2-devel@lists.01.org; +Cc: Kinney, Michael D

Reviewed-by: Liming Gao <liming.gao@intel.com>

>-----Original Message-----
>From: Ni, Ruiyu
>Sent: Wednesday, October 24, 2018 12:43 PM
>To: Jim.Dailey@dell.com; edk2-devel@lists.01.org
>Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Gao, Liming
><liming.gao@intel.com>
>Subject: RE: [edk2] [PATCH] MdePkg-BaseLib: Fix PathCleanUpDirectories()
>issue with "\\..\\.."
>
>Reviewed-by: Ruiyu Ni <Ruiyu.ni@Intel.com>
>
>Thanks/Ray
>
>> -----Original Message-----
>> From: edk2-devel <edk2-devel-bounces@lists.01.org> On Behalf Of
>> Jim.Dailey@dell.com
>> Sent: Saturday, October 6, 2018 3:15 AM
>> To: edk2-devel@lists.01.org
>> Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Gao, Liming
>> <liming.gao@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_dailey@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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-10-24  4:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-05 19:14 [PATCH] MdePkg-BaseLib: Fix PathCleanUpDirectories() issue with "\\..\\.." Jim.Dailey
2018-10-24  4:42 ` Ni, Ruiyu
2018-10-24  4:44   ` Gao, Liming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox