Fix bugs appearing from fuzzing.
diff --git a/sections/cper-section-ccix-per.c b/sections/cper-section-ccix-per.c
index 072c5d2..d295017 100644
--- a/sections/cper-section-ccix-per.c
+++ b/sections/cper-section-ccix-per.c
@@ -32,7 +32,7 @@
//CCIX PER Log.
//This is formatted as described in Section 7.3.2 of CCIX Base Specification (Rev 1.0).
unsigned char* cur_pos = (unsigned char*)(ccix_error + 1);
- int remaining_length = ccix_error->Length - sizeof(ccix_error);
+ int remaining_length = ccix_error->Length - sizeof(EFI_CCIX_PER_LOG_DATA);
if (remaining_length > 0)
{
char* encoded = b64_encode(cur_pos, remaining_length);
@@ -67,7 +67,7 @@
//Write CCIX PER log itself to stream.
json_object* encoded = json_object_object_get(section, "ccixPERLog");
UINT8* decoded = b64_decode(json_object_get_string(encoded), json_object_get_string_len(encoded));
- fwrite(decoded, section_cper->Length - sizeof(section_cper), 1, out);
+ fwrite(decoded, section_cper->Length - sizeof(EFI_CCIX_PER_LOG_DATA), 1, out);
fflush(out);
//Free resources.