diff options
Diffstat (limited to 'ShellPkg/Application/Shell')
-rw-r--r-- | ShellPkg/Application/Shell/FileHandleWrappers.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/ShellPkg/Application/Shell/FileHandleWrappers.c b/ShellPkg/Application/Shell/FileHandleWrappers.c index be786bb2b5..d3fc5dc578 100644 --- a/ShellPkg/Application/Shell/FileHandleWrappers.c +++ b/ShellPkg/Application/Shell/FileHandleWrappers.c @@ -1140,6 +1140,7 @@ CreateFileInterfaceEnv( )
{
EFI_FILE_PROTOCOL_ENVIRONMENT *EnvFileInterface;
+ UINTN EnvNameSize;
if (EnvName == NULL) {
return (NULL);
@@ -1148,7 +1149,8 @@ CreateFileInterfaceEnv( //
// Get some memory
//
- EnvFileInterface = AllocateZeroPool(sizeof(EFI_FILE_PROTOCOL_ENVIRONMENT)+StrSize(EnvName));
+ EnvNameSize = StrSize(EnvName);
+ EnvFileInterface = AllocateZeroPool(sizeof(EFI_FILE_PROTOCOL_ENVIRONMENT)+EnvNameSize);
if (EnvFileInterface == NULL){
return (NULL);
}
@@ -1166,8 +1168,8 @@ CreateFileInterfaceEnv( EnvFileInterface->Flush = FileInterfaceNopGeneric;
EnvFileInterface->Delete = FileInterfaceEnvDelete;
EnvFileInterface->Read = FileInterfaceEnvRead;
-
- StrnCpy(EnvFileInterface->Name, EnvName, StrLen(EnvName));
+
+ CopyMem(EnvFileInterface->Name, EnvName, EnvNameSize);
//
// Assign the different members for Volatile and Non-Volatile variables
|