>-----Original Message-----
>From: Ni, Ruiyu [mailto:ruiyu...@intel.com] 
>Sent: Monday, October 8, 2018 9:55 PM
>To: Dailey, Jim
>Cc: michael.d.kin...@intel.com; liming....@intel.com; edk2-devel@lists.01.org
>Subject: Re: [edk2] [PATCH] MdePkg-BaseLib: Fix PathCleanUpDirectories() error 
>involving "\..\.."
>
>
>On 10/8/2018 9:23 PM, jim.dai...@dell.com wrote:
>>> -----Original Message-----
>>>>
>>>> diff --git a/MdePkg/Library/BaseLib/FilePaths.c 
>>>> b/MdePkg/Library/BaseLib/FilePaths.c
>>>> index d6f3758ecb..5d3de01894 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
>>>> @@ -103,7 +104,9 @@ PathCleanUpDirectories(
>>>>            ) {
>>>>        *(TempString + 1) = CHAR_NULL;
>>>>        PathRemoveLastItem(Path);
>>>> -    CopyMem (Path + StrLen (Path), TempString + 3, StrSize (TempString + 
>>>> 3));
>>>> +    if (*(TempString + 3)) {
>>>> +      CopyMem (Path + StrLen (Path), TempString + 4, StrSize (TempString 
>>>> + 4));
>>>> +    }
>I just setup a debugging environment to trace the code. Finally I 
>understand the issue.
>I agree to change "TempString + 3" to "TempString + 4". This can 
>eliminate double slash so in next same loop, the pattern "\\..\\" or 
>"\\..\0" can be detected and "last item" can be correctly removed by 
>PathRemoveLastItem().
>
>Can you change
>  "if (*(TempString + 3))"
>  to
>  "if (*(TempString + 3) != CHAR_NULL)"?
>
>With the above change, Reviewed-by: Ruiyu Ni <ruiyu...@intel.com>
>If you agree, I can modify your patch and push it for you.
>
>-- 
>Thanks,
>Ray

Sure, I have no problem with `*(TempString + 3) != CHAR_NULL`. Feel
free to make that change and push it.

Thanks,
Jim
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to