From: jcarsey Date: Fri, 29 Jan 2010 15:07:44 +0000 (+0000) Subject: fix K8 coding issues. X-Git-Tag: edk2-stable201903~16474 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=1cd45e787dc658e17a92292795b93ce71d01be4b fix K8 coding issues. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9862 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c b/ShellPkg/Library/UefiShellLib/UefiShellLib.c index f105176bf6..0d6a30e6e9 100644 --- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c +++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c @@ -107,7 +107,7 @@ ShellFindSE2 ( Buffer ); } - if (!EFI_ERROR (Status)) { + if (!EFI_ERROR (Status) && Buffer != NULL) { // // now parse the list of returned handles // @@ -1490,6 +1490,7 @@ ShellFindFilePath ( CHAR16 *TestPath; CONST CHAR16 *Walker; UINTN Size; + CHAR16 *TempChar; RetVal = NULL; @@ -1517,8 +1518,9 @@ ShellFindFilePath ( Walker = (CHAR16*)Path; do { CopyMem(TestPath, Walker, StrSize(Walker)); - if (StrStr(TestPath, L";") != NULL) { - *(StrStr(TestPath, L";")) = CHAR_NULL; + TempChar = StrStr(TestPath, L";"); + if (TempChar != NULL) { + *TempChar = CHAR_NULL; } StrCat(TestPath, FileName); if (StrStr(Walker, L";") != NULL) { @@ -1565,6 +1567,8 @@ ShellFindFilePathEx ( CHAR16 *RetVal; CONST CHAR16 *ExtensionWalker; UINTN Size; + CHAR16 *TempChar; + ASSERT(FileName != NULL); if (FileExtension == NULL) { return (ShellFindFilePath(FileName)); @@ -1578,9 +1582,12 @@ ShellFindFilePathEx ( TestPath = AllocateZeroPool(Size); for (ExtensionWalker = FileExtension ; ; ExtensionWalker = StrStr(ExtensionWalker, L";") + 1 ){ StrCpy(TestPath, FileName); - StrCat(TestPath, ExtensionWalker); - if (StrStr(TestPath, L";") != NULL) { - *(StrStr(TestPath, L";")) = CHAR_NULL; + if (ExtensionWalker != NULL) { + StrCat(TestPath, ExtensionWalker); + } + TempChar = StrStr(TestPath, L";"); + if (TempChar != NULL) { + *TempChar = CHAR_NULL; } RetVal = ShellFindFilePath(TestPath); if (RetVal != NULL) { @@ -2696,10 +2703,15 @@ ShellStrToUintn( { CONST CHAR16 *Walker; for (Walker = String; Walker != NULL && *Walker != CHAR_NULL && *Walker == L' '; Walker++); - if (StrnCmp(Walker, L"0x", 2) == 0 || StrnCmp(Walker, L"0X", 2) == 0){ - return (StrHexToUintn(Walker)); + if (Walker == NULL || *Walker == CHAR_NULL) { + ASSERT(FALSE); + return ((UINTN)(-1)); + } else { + if (StrnCmp(Walker, L"0x", 2) == 0 || StrnCmp(Walker, L"0X", 2) == 0){ + return (StrHexToUintn(Walker)); + } + return (StrDecimalToUintn(Walker)); } - return (StrDecimalToUintn(Walker)); } /**