EFI_FILE_PROTOCOL wrappers for other items (Like Environment Variables,\r
StdIn, StdOut, StdErr, etc...).\r
\r
- Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r
Copyright (c) 2013, Hewlett-Packard Development Company, L.P.\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
Status = SHELL_GET_ENVIRONMENT_VARIABLE(((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name, &NewSize, NewBuffer);\r
}\r
\r
- if (!EFI_ERROR(Status)) {\r
+ if (!EFI_ERROR(Status) && NewBuffer != NULL) {\r
\r
if (StrSize(NewBuffer) > 6)\r
{\r
if (Status == EFI_BUFFER_TOO_SMALL) {\r
SHELL_FREE_NON_NULL(FoundVarName);\r
FoundVarName = AllocateZeroPool (NameSize);\r
- if (PrevName != NULL) {\r
- StrCpy(FoundVarName, PrevName);\r
- }\r
+ if (FoundVarName != NULL) {\r
+ if (PrevName != NULL) {\r
+ StrCpy(FoundVarName, PrevName);\r
+ }\r
\r
- Status = gRT->GetNextVariableName (&NameSize, FoundVarName, &FoundVarGuid);\r
+ Status = gRT->GetNextVariableName (&NameSize, FoundVarName, &FoundVarGuid);\r
+ } else {\r
+ Status = EFI_OUT_OF_RESOURCES;\r
+ }\r
}\r
\r
//\r