Skip to content

Commit c0e8742

Browse files
Copilotmaxtropets
andauthored
Fix out-of-bounds argv access in SNP attestation JS binding (#7818)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: maxtropets <16566519+maxtropets@users.noreply.github.com>
1 parent 1622a32 commit c0e8742

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/js/extensions/snp_attestation.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ namespace ccf::js::extensions
6161
}
6262

6363
std::optional<std::vector<uint8_t>> uvm_endorsements;
64-
if (JS_IsUndefined(argv[2]) == 0)
64+
if (argc >= 3 && JS_IsUndefined(argv[2]) == 0)
6565
{
6666
size_t uvm_endorsements_size = 0;
6767
uint8_t* uvm_endorsements_array =
@@ -76,7 +76,7 @@ namespace ccf::js::extensions
7676
}
7777

7878
std::optional<std::string> endorsed_tcb;
79-
if (JS_IsUndefined(argv[3]) == 0)
79+
if (argc >= 4 && JS_IsUndefined(argv[3]) == 0)
8080
{
8181
endorsed_tcb = jsctx.to_str(argv[3]);
8282
if (!endorsed_tcb)

0 commit comments

Comments
 (0)