summaryrefslogtreecommitdiffstats
path: root/src/pcrlock/pcrlock.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pcrlock/pcrlock.c')
-rw-r--r--src/pcrlock/pcrlock.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/pcrlock/pcrlock.c b/src/pcrlock/pcrlock.c
index 1716fb3..9a7b73f 100644
--- a/src/pcrlock/pcrlock.c
+++ b/src/pcrlock/pcrlock.c
@@ -1925,6 +1925,9 @@ static int event_log_map_components(EventLog *el) {
continue;
}
+ if (c->n_variants == 0)
+ log_notice("Component '%s' has no defined variants.", c->id);
+
FOREACH_ARRAY(ii, c->variants, c->n_variants) {
EventLogComponentVariant *i = *ii;
@@ -4060,6 +4063,15 @@ static int event_log_predict_pcrs(
component = ASSERT_PTR(el->components[component_index]);
+ if (component->n_variants == 0)
+ return event_log_predict_pcrs(
+ el,
+ context,
+ parent_result,
+ component_index + 1, /* Next component */
+ pcr,
+ path);
+
FOREACH_ARRAY(ii, component->variants, component->n_variants) {
_cleanup_free_ Tpm2PCRPredictionResult *result = NULL;
EventLogComponentVariant *variant = *ii;
@@ -4118,7 +4130,9 @@ static ssize_t event_log_calculate_component_combinations(EventLog *el) {
/* Overflow check */
if (c->n_variants > (size_t) (SSIZE_MAX/count))
return log_error_errno(SYNTHETIC_ERRNO(E2BIG), "Too many component combinations.");
-
+ /* If no variant, this will lead to count being 0 and sigfpe */
+ if (c->n_variants == 0)
+ continue;
count *= c->n_variants;
}