NetworkPkg: UefiPxeBcDxe: SECURITY PATCH CVE-2023-45234 Unit Tests

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4539

Unit tests to that the bug..

Buffer overflow when processing DNS Servers option in a DHCPv6 Advertise
message

..has been patched

This contains tests for the following functions:
PxeBcHandleDhcp6Offer
PxeBcCacheDnsServerAddresses

Cc: Saloni Kasbekar <saloni.kasbekar@intel.com>
Cc: Zachary Clark-williams <zachary.clark-williams@intel.com>

Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com>
Reviewed-by: Saloni Kasbekar <saloni.kasbekar@intel.com>
This commit is contained in:
Doug Flick
2024-01-26 05:54:53 +08:00
committed by mergify[bot]
parent 1b53515d53
commit 458c582685
5 changed files with 418 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
/** @file
This file exposes the internal interfaces which may be unit tested
for the PxeBcDhcp6Dxe driver.
Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef PXE_BC_DHCP6_GOOGLE_TEST_H_
#define PXE_BC_DHCP6_GOOGLE_TEST_H_
//
// Minimal includes needed to compile
//
#include <Uefi.h>
#include "../PxeBcImpl.h"
/**
Handle the DHCPv6 offer packet.
@param[in] Private The pointer to PXEBC_PRIVATE_DATA.
@retval EFI_SUCCESS Handled the DHCPv6 offer packet successfully.
@retval EFI_NO_RESPONSE No response to the following request packet.
@retval EFI_OUT_OF_RESOURCES Failed to allocate resources.
@retval EFI_BUFFER_TOO_SMALL Can't cache the offer pacet.
**/
EFI_STATUS
PxeBcHandleDhcp6Offer (
IN PXEBC_PRIVATE_DATA *Private
);
/**
Cache the DHCPv6 Server address
@param[in] Private The pointer to PXEBC_PRIVATE_DATA.
@param[in] Cache6 The pointer to PXEBC_DHCP6_PACKET_CACHE.
@retval EFI_SUCCESS Cache the DHCPv6 Server address successfully.
@retval EFI_OUT_OF_RESOURCES Failed to allocate resources.
@retval EFI_DEVICE_ERROR Failed to cache the DHCPv6 Server address.
**/
EFI_STATUS
PxeBcCacheDnsServerAddresses (
IN PXEBC_PRIVATE_DATA *Private,
IN PXEBC_DHCP6_PACKET_CACHE *Cache6
);
#endif // PXE_BC_DHCP6_GOOGLE_TEST_H_