Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trusted names security fixes #655

Merged
merged 2 commits into from
Sep 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src_features/provideTrustedName/cmd_provide_trusted_name.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ bool has_trusted_name(uint8_t types_count,
}
if (ret) break;
}
memset(&g_trusted_name_info, 0, sizeof(g_trusted_name_info));
explicit_bzero(&g_trusted_name_info, sizeof(g_trusted_name_info));
}
return ret;
}
Expand Down Expand Up @@ -809,7 +809,8 @@ static bool parse_tlv(const s_tlv_payload *payload,
break;

case TLV_VALUE:
if (offset >= payload->size) {
if ((offset + data.length) > payload->size) {
PRINTF("Error: value would go beyond the TLV payload!\n");
return false;
}
data.value = &payload->buf[offset];
Expand All @@ -833,6 +834,10 @@ static bool parse_tlv(const s_tlv_payload *payload,
return false;
}
}
if (step != TLV_TAG) {
PRINTF("Error: unexpected data at the end of the TLV payload!\n");
return false;
}
return verify_struct(trusted_name_info);
}

Expand Down
Loading