mirror of https://github.com/acidanthera/audk.git
MdeModulePkg/SetupBrowser:Add NULL check before using a pointer
Add NULL pointer check before using a pointer to avoid possible NULL pointer dereference. Cc: Eric Dong <eric.dong@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com>
This commit is contained in:
parent
96207191fd
commit
66918edd34
|
@ -1486,7 +1486,9 @@ BufferToValue (
|
|||
//
|
||||
if (Question->QuestionReferToBitField) {
|
||||
Buffer = (UINT8 *)AllocateZeroPool (Question->StorageWidth);
|
||||
ASSERT (Buffer != NULL);
|
||||
if (Buffer == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
Dst = Buffer;
|
||||
} else {
|
||||
Dst = (UINT8 *) &Question->HiiValue.Value;
|
||||
|
@ -1548,11 +1550,9 @@ BufferToValue (
|
|||
|
||||
*StringPtr = TempChar;
|
||||
|
||||
if (Question->QuestionReferToBitField) {
|
||||
if (Buffer != NULL && Question->QuestionReferToBitField) {
|
||||
GetBitsQuestionValue (Question, Buffer);
|
||||
if (Buffer != NULL) {
|
||||
FreePool (Buffer);
|
||||
}
|
||||
FreePool (Buffer);
|
||||
}
|
||||
|
||||
return Status;
|
||||
|
|
Loading…
Reference in New Issue