From 5cdeff1eb3533e9791673495f7636f573c39eaf8 Mon Sep 17 00:00:00 2001 From: Abner Chang Date: Thu, 23 Nov 2023 18:42:37 +0800 Subject: RedfishPkg/HostInterfaceBmcUsbNic: Fix incorrect HI protocol record size The size of structure must be minus with byte that is occupied by the initial array. Signed-off-by: Abner Chang Cc: Nickle Wang Cc: Igor Kulchytskyy Cc: Mike Maslenkin Reviewed-by: Nickle Wang Acked-by: Mike Maslenkin --- .../PlatformHostInterfaceBmcUsbNicLib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'RedfishPkg/Library') diff --git a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c b/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c index 237ad4e455..a4c624208a 100644 --- a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c +++ b/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c @@ -180,7 +180,7 @@ RedfishPlatformHostInterfaceProtocolData ( HostNameLength = (UINT8)AsciiStrSize (HostNameString); ThisProtocolRecord = (MC_HOST_INTERFACE_PROTOCOL_RECORD *)AllocateZeroPool ( sizeof (MC_HOST_INTERFACE_PROTOCOL_RECORD) - 1 + - sizeof (REDFISH_OVER_IP_PROTOCOL_DATA) + + sizeof (REDFISH_OVER_IP_PROTOCOL_DATA) - 1 + HostNameLength ); if (ThisProtocolRecord == NULL) { @@ -189,7 +189,7 @@ RedfishPlatformHostInterfaceProtocolData ( } ThisProtocolRecord->ProtocolType = MCHostInterfaceProtocolTypeRedfishOverIP; - ThisProtocolRecord->ProtocolTypeDataLen = sizeof (REDFISH_OVER_IP_PROTOCOL_DATA) + HostNameLength; + ThisProtocolRecord->ProtocolTypeDataLen = sizeof (REDFISH_OVER_IP_PROTOCOL_DATA) -1 + HostNameLength; RedfishOverIpData = (REDFISH_OVER_IP_PROTOCOL_DATA *)&ThisProtocolRecord->ProtocolTypeData[0]; // // Fill up REDFISH_OVER_IP_PROTOCOL_DATA -- cgit v1.2.3