bios_table: Relax pldm_bios_table_string_entry_decode_string_check()
Allow the string decoded by
pldm_bios_table_string_entry_decode_string_check() to be truncated, as
per the unchecked pldm_bios_table_string_entry_decode_string(). With
this change pldm_bios_table_string_entry_decode_string_check() provides
assert() safety but is otherwise equivalent.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: Ia872f1496c642efbb34ee3ae29455f4eaf574082
diff --git a/src/bios_table.c b/src/bios_table.c
index 436f3e6..d6cf6f3 100644
--- a/src/bios_table.c
+++ b/src/bios_table.c
@@ -114,9 +114,9 @@
{
POINTER_CHECK(entry);
POINTER_CHECK(buffer);
- size_t length =
- pldm_bios_table_string_entry_decode_string_length(entry);
- BUFFER_SIZE_EXPECT(size, length + 1);
+ if (size == 0) {
+ return PLDM_ERROR_INVALID_LENGTH;
+ }
pldm_bios_table_string_entry_decode_string(entry, buffer, size);
return PLDM_SUCCESS;
}