Skip to content

Commit 1da3645

Browse files
committed
swtpm_cert: Return NULL if coordinates of EC key exceed expected sizes
Return NULL for failure if coordinates of passed EC key exceed expected sizes. Signed-off-by: Stefan Berger <[email protected]>
1 parent 7eb7eb4 commit 1da3645

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/swtpm_cert/ek-cert.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,12 +351,13 @@ create_ecc_from_x_and_y(unsigned char *ecc_x, unsigned int ecc_x_len,
351351
exp_len = 528/8;
352352
} else {
353353
fprintf(stderr, "Unsupported ECC curve id: %s\n", ecc_curveid);
354-
return NULL;
354+
goto cleanup;
355355
}
356356
if (ecc_x_len > exp_len || ecc_y_len > exp_len) {
357357
fprintf(stderr,
358358
"EC X or Y parameter exceeds expected size of %zu bytes\n",
359359
exp_len);
360+
goto cleanup;
360361
}
361362
buffer = g_malloc0(1 + 2 * exp_len);
362363
buffer[0] = 0x4;

0 commit comments

Comments
 (0)