Skip to content

Commit

Permalink
guest/read: return early if next esd cannot be parsed
Browse files Browse the repository at this point in the history
Matching the rest of the function, don't continue iterating through
ESDs if one fails to parse.

Also adjusts the error message on signature type to state "unknown"
signature type instead of invalid, since it may not be supported yet.
This is the one "error" case that continues without exiting early.

Signed-off-by: Eric Richter <[email protected]>
  • Loading branch information
erichte-ibm committed Oct 6, 2023
1 parent d991247 commit ec6a037
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion backends/guest/common/read.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,14 @@ static int print_esd_from_esl_buffer(const uint8_t *esl, size_t esl_size,
print_raw((char *)curr_esd.raw, esd_data_size);
break;
default:
prlog(PR_ERR, "ERROR: invalid signature type = %d\n", sig_type);
prlog(PR_ERR, "ERROR: unknown signature type = %d\n", sig_type);
break;
}

rc = next_esd_from_esl(esl, &curr_esd.raw, &esd_data_size, &esd_owner);
if (rc) {
prlog(PR_ERR, "Error reading next esd (%zu), rc = %d\n", esd_count, rc);
return rc;
}
}

Expand Down

0 comments on commit ec6a037

Please sign in to comment.