NetworkPkg/Dhcp6Dxe: Defensively check for NULL Config in Dhcp6UpdateIaInfo

Replace the ASSERT (Instance->Config != NULL) in Dhcp6UpdateIaInfo with
an explicit NULL check that returns EFI_DEVICE_ERROR. Also add a
complementary guard in Dhcp6GenerateIaCb alongside the existing check
for Instance->IaCb.Ia. These are defensive changes to prevent potential
NULL pointer dereferences.

Signed-off-by: Abuthahir M <abuthahirm@ami.com>
This commit is contained in:
abuthahirm 2026-04-30 16:59:03 +05:30 committed by mergify[bot]
parent 0f07c187d0
commit bc15a87b74
2 changed files with 4 additions and 2 deletions

View file

@ -538,7 +538,9 @@ Dhcp6UpdateIaInfo (
T1 = 0;
T2 = 0;
ASSERT (Instance->Config != NULL);
if (Instance->Config == NULL) {
return EFI_DEVICE_ERROR;
}
// OptionLen is the length of the Options excluding the DHCP header.
// Length of the EFI_DHCP6_PACKET from the first byte of the Header field to the last

View file

@ -1335,7 +1335,7 @@ Dhcp6GenerateIaCb (
UINT32 IaSize;
EFI_DHCP6_IA *Ia;
if (Instance->IaCb.Ia == NULL) {
if ((Instance->IaCb.Ia == NULL) || (Instance->Config == NULL)) {
return EFI_DEVICE_ERROR;
}