mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-26 07:04:28 +02:00
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) {
|
if (Question->QuestionReferToBitField) {
|
||||||
Buffer = (UINT8 *)AllocateZeroPool (Question->StorageWidth);
|
Buffer = (UINT8 *)AllocateZeroPool (Question->StorageWidth);
|
||||||
ASSERT (Buffer != NULL);
|
if (Buffer == NULL) {
|
||||||
|
return EFI_OUT_OF_RESOURCES;
|
||||||
|
}
|
||||||
Dst = Buffer;
|
Dst = Buffer;
|
||||||
} else {
|
} else {
|
||||||
Dst = (UINT8 *) &Question->HiiValue.Value;
|
Dst = (UINT8 *) &Question->HiiValue.Value;
|
||||||
@ -1548,12 +1550,10 @@ BufferToValue (
|
|||||||
|
|
||||||
*StringPtr = TempChar;
|
*StringPtr = TempChar;
|
||||||
|
|
||||||
if (Question->QuestionReferToBitField) {
|
if (Buffer != NULL && Question->QuestionReferToBitField) {
|
||||||
GetBitsQuestionValue (Question, Buffer);
|
GetBitsQuestionValue (Question, Buffer);
|
||||||
if (Buffer != NULL) {
|
|
||||||
FreePool (Buffer);
|
FreePool (Buffer);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user