Refine the code logic, use dynamic allocate buffer instead of static array to fix potential buffer overflow.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15829 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
The defintions are required both by Source code and Vfr file.
|
||||
The PLAT_OVER_MNGR_DATA structure, form guid and Ifr question ID are defined.
|
||||
|
||||
Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -22,7 +22,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
//
|
||||
// The max number of the supported driver list.
|
||||
//
|
||||
#define MAX_CHOICE_NUM 0x00ff
|
||||
#define MAX_CHOICE_NUM 0x00FF
|
||||
#define UPDATE_DATA_SIZE 0x1000
|
||||
|
||||
#define FORM_ID_DEVICE 0x1100
|
||||
@@ -30,7 +30,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#define FORM_ID_ORDER 0x1500
|
||||
|
||||
#define KEY_VALUE_DEVICE_OFFSET 0x0100
|
||||
#define KEY_VALUE_DEVICE_MAX (KEY_VALUE_DEVICE_OFFSET + MAX_CHOICE_NUM)
|
||||
#define KEY_VALUE_DRIVER_OFFSET 0x0300
|
||||
|
||||
#define KEY_VALUE_DEVICE_REFRESH 0x1234
|
||||
#define KEY_VALUE_DEVICE_FILTER 0x1235
|
||||
@@ -47,7 +47,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#define LABEL_END 0xffff
|
||||
|
||||
typedef struct {
|
||||
UINT8 DriSelection[MAX_CHOICE_NUM];
|
||||
UINT8 DriOrder[MAX_CHOICE_NUM];
|
||||
UINT8 PciDeviceFilter;
|
||||
} PLAT_OVER_MNGR_DATA;
|
||||
@@ -56,7 +55,6 @@ typedef struct {
|
||||
// Field offset of structure PLAT_OVER_MNGR_DATA
|
||||
//
|
||||
#define VAR_OFFSET(Field) ((UINTN) &(((PLAT_OVER_MNGR_DATA *) 0)->Field))
|
||||
#define DRIVER_SELECTION_VAR_OFFSET (VAR_OFFSET (DriSelection))
|
||||
#define DRIVER_ORDER_VAR_OFFSET (VAR_OFFSET (DriOrder))
|
||||
|
||||
//
|
||||
@@ -64,7 +62,6 @@ typedef struct {
|
||||
// In order to avoid to conflict them, the Driver Selection and Order QuestionID offset is defined from 0x0500.
|
||||
//
|
||||
#define QUESTION_ID_OFFSET 0x0500
|
||||
#define DRIVER_SELECTION_QUESTION_ID (VAR_OFFSET (DriSelection) + QUESTION_ID_OFFSET)
|
||||
#define DRIVER_ORDER_QUESTION_ID (VAR_OFFSET (DriOrder) + QUESTION_ID_OFFSET)
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user