summaryrefslogtreecommitdiff
path: root/ShellPkg/Library
diff options
context:
space:
mode:
authorjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>2010-01-29 15:07:44 +0000
committerjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>2010-01-29 15:07:44 +0000
commit1cd45e787dc658e17a92292795b93ce71d01be4b (patch)
tree04fa85c8b3d045759fde083b316b4869e88bca62 /ShellPkg/Library
parent75dad611c8c8f5bb643b2c458ab98afbf24b24fd (diff)
downloadedk2-1cd45e787dc658e17a92292795b93ce71d01be4b.tar.gz
fix K8 coding issues.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9862 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ShellPkg/Library')
-rw-r--r--ShellPkg/Library/UefiShellLib/UefiShellLib.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
index f105176bf..0d6a30e6e 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));
}
/**