NetworkPkg/Ip6Dxe: Improve Neightbor Discovery message validation.
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2174 Problem has been identified with Ip6ProcessRouterAdvertise() when Router Advertise packet contains options with malicious/invalid 'Length' field. This can lead to platform entering infinite loop when processing options from that packet. Cc: Jiaxin Wu <jiaxin.wu@intel.com> Cc: Siyuan Fu <siyuan.fu@intel.com> Signed-off-by: Maciej Rabeda <maciej.rabeda@linux.intel.com> Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
This commit is contained in:
committed by
mergify[bot]
parent
3000c2963d
commit
9c20342eed
@@ -56,12 +56,21 @@ VOID
|
||||
VOID *Context
|
||||
);
|
||||
|
||||
typedef struct _IP6_OPTION_HEADER {
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
} IP6_OPTION_HEADER;
|
||||
|
||||
STATIC_ASSERT (sizeof (IP6_OPTION_HEADER) == 2, "IP6_OPTION_HEADER is expected to be exactly 2 bytes long.");
|
||||
|
||||
typedef struct _IP6_ETHE_ADDR_OPTION {
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT8 EtherAddr[6];
|
||||
} IP6_ETHER_ADDR_OPTION;
|
||||
|
||||
STATIC_ASSERT (sizeof (IP6_ETHER_ADDR_OPTION) == 8, "IP6_ETHER_ADDR_OPTION is expected to be exactly 8 bytes long.");
|
||||
|
||||
typedef struct _IP6_MTU_OPTION {
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
@@ -69,6 +78,8 @@ typedef struct _IP6_MTU_OPTION {
|
||||
UINT32 Mtu;
|
||||
} IP6_MTU_OPTION;
|
||||
|
||||
STATIC_ASSERT (sizeof (IP6_MTU_OPTION) == 8, "IP6_MTU_OPTION is expected to be exactly 8 bytes long.");
|
||||
|
||||
typedef struct _IP6_PREFIX_INFO_OPTION {
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
@@ -80,6 +91,8 @@ typedef struct _IP6_PREFIX_INFO_OPTION {
|
||||
EFI_IPv6_ADDRESS Prefix;
|
||||
} IP6_PREFIX_INFO_OPTION;
|
||||
|
||||
STATIC_ASSERT (sizeof (IP6_PREFIX_INFO_OPTION) == 32, "IP6_PREFIX_INFO_OPTION is expected to be exactly 32 bytes long.");
|
||||
|
||||
typedef
|
||||
VOID
|
||||
(*IP6_DAD_CALLBACK) (
|
||||
|
Reference in New Issue
Block a user