pdr: Validate arguments to pldm_pdr_add_fru_record_set_check()
Previously bmc_record_handle were dereferenced without validation. Fix
that by testing both pointer arguments are not NULL.
Fixes: c821a7004e9e ("pdr: Introduce pldm_pdr_add_fru_record_set_check()")
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: Ie964cfe115d9f88def64092c06ccea8f26e1b7a4
diff --git a/src/pdr.c b/src/pdr.c
index 31e3be6..4b34196 100644
--- a/src/pdr.c
+++ b/src/pdr.c
@@ -299,6 +299,10 @@
uint16_t container_id,
uint32_t *bmc_record_handle)
{
+ if (!repo || !bmc_record_handle) {
+ return -EINVAL;
+ }
+
uint32_t size = sizeof(struct pldm_pdr_hdr) +
sizeof(struct pldm_pdr_fru_record_set);
uint8_t data[size];