Thanks for the comments! I will update the patch.
Thanks, Dandan -----Original Message----- From: Zhang, Chao B Sent: Tuesday, March 1, 2016 9:56 PM To: Bi, Dandan <dandan...@intel.com>; edk2-devel@lists.01.org Cc: Qiu, Shumin <shumin....@intel.com>; Dong, Eric <eric.d...@intel.com> Subject: RE: [patch] SecurityPkg: SecureBootConfigDxe: Enhance the code logic Dandan: 1. Please update function description accordingly. 2. I can see other ASSERT in UpdatePage. Please also remove it. Thanks & Best regards Chao Zhang -----Original Message----- From: Bi, Dandan Sent: Tuesday, March 01, 2016 4:49 PM To: edk2-devel@lists.01.org Cc: Zhang, Chao B; Qiu, Shumin; Dong, Eric Subject: [patch] SecurityPkg: SecureBootConfigDxe: Enhance the code logic The function AllocateCopyPool may return NULL, so need to do check after calling it. This patch is to enhance the related logic. Cc: Chao Zhang <chao.b.zh...@intel.com> Cc: Qiu Shumin <shumin....@intel.com> Cc: Eric Dong <eric.d...@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan...@intel.com> --- .../SecureBootConfigDxe/SecureBootConfigFileExplorer.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigFileExplorer.c b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigFileExplorer.c index 2adb85c..7787d64 100644 --- a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigFileExplorer.c +++ b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootCo +++ nfigFileExplorer.c @@ -243,19 +243,22 @@ ExtractFileNameFromDevicePath ( ASSERT(DevicePath != NULL); String = DevicePathToStr(DevicePath); MatchString = String; LastMatch = String; + FileName = NULL; while(MatchString != NULL){ LastMatch = MatchString + 1; MatchString = StrStr(LastMatch,L"\\"); } Length = StrLen(LastMatch); FileName = AllocateCopyPool ((Length + 1) * sizeof(CHAR16), LastMatch); - *(FileName + Length) = 0; + if (FileName != NULL) { + *(FileName + Length) = 0; + } FreePool(String); return FileName; } @@ -278,12 +281,16 @@ UpdatePage( ) { CHAR16 *FileName; EFI_STRING_ID StringToken; - if (FilePath != NULL){ + FileName = NULL; + + if (FilePath != NULL) { FileName = ExtractFileNameFromDevicePath(FilePath); + } + if (FileName != NULL) { StringToken = HiiSetString (gSecureBootPrivateData->HiiHandle, 0, FileName, NULL); } else { FileName = HiiGetString (gSecureBootPrivateData->HiiHandle, STRING_TOKEN (STR_NULL), NULL); ASSERT (FileName != NULL); StringToken = HiiSetString (gSecureBootPrivateData->HiiHandle, 0, FileName, NULL); -- 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel