mirror of https://github.com/acidanthera/audk.git
MdeModulePkg/Universal/FvSimpleFileSystemDxe: Use safe string functions to refine code.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Qiu Shumin <shumin.qiu@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17785 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
931d4d8269
commit
f5fc27424b
|
@ -12,7 +12,7 @@
|
||||||
from the UEFI shell. It is entirely read-only.
|
from the UEFI shell. It is entirely read-only.
|
||||||
|
|
||||||
Copyright (c) 2014, ARM Limited. All rights reserved.
|
Copyright (c) 2014, ARM Limited. All rights reserved.
|
||||||
Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||||
|
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
@ -898,7 +898,11 @@ FvSimpleFileSystemGetInfo (
|
||||||
FsInfoOut = (EFI_FILE_SYSTEM_INFO *) Buffer;
|
FsInfoOut = (EFI_FILE_SYSTEM_INFO *) Buffer;
|
||||||
|
|
||||||
CopyMem (FsInfoOut, &mFsInfoTemplate, sizeof (EFI_FILE_SYSTEM_INFO));
|
CopyMem (FsInfoOut, &mFsInfoTemplate, sizeof (EFI_FILE_SYSTEM_INFO));
|
||||||
Status = StrnCpyS (FsInfoOut->VolumeLabel, (*BufferSize - OFFSET_OF (EFI_FILE_SYSTEM_INFO, VolumeLabel)) / sizeof (CHAR16), Instance->VolumeLabel, StrLen (Instance->VolumeLabel));
|
Status = StrnCpyS ( FsInfoOut->VolumeLabel,
|
||||||
|
(*BufferSize - OFFSET_OF (EFI_FILE_SYSTEM_INFO, VolumeLabel)) / sizeof (CHAR16),
|
||||||
|
Instance->VolumeLabel,
|
||||||
|
StrLen (Instance->VolumeLabel)
|
||||||
|
);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
FsInfoOut->Size = Size;
|
FsInfoOut->Size = Size;
|
||||||
return Status;
|
return Status;
|
||||||
|
@ -919,7 +923,11 @@ FvSimpleFileSystemGetInfo (
|
||||||
}
|
}
|
||||||
|
|
||||||
FsVolumeLabel = (EFI_FILE_SYSTEM_VOLUME_LABEL*) Buffer;
|
FsVolumeLabel = (EFI_FILE_SYSTEM_VOLUME_LABEL*) Buffer;
|
||||||
Status = StrnCpyS (FsVolumeLabel->VolumeLabel, (*BufferSize - OFFSET_OF (EFI_FILE_SYSTEM_VOLUME_LABEL, VolumeLabel)) / sizeof (CHAR16), Instance->VolumeLabel, StrLen (Instance->VolumeLabel));
|
Status = StrnCpyS (FsVolumeLabel->VolumeLabel,
|
||||||
|
(*BufferSize - OFFSET_OF (EFI_FILE_SYSTEM_VOLUME_LABEL, VolumeLabel)) / sizeof (CHAR16),
|
||||||
|
Instance->VolumeLabel,
|
||||||
|
StrLen (Instance->VolumeLabel)
|
||||||
|
);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
return Status;
|
return Status;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue