@@ -1139,6 +1139,9 @@ int if_bct_is_t114_get_soc_config(build_image_context *context,
{
nvboot_config_table * bct = (nvboot_config_table *) context->bct;
+ if (context->bct_size < sizeof(nvboot_config_table))
+ return 0;
+
if (bct->boot_data_version == BOOTDATA_VERSION_T114)
{
t114_get_soc_config(context, soc_config);
@@ -1152,6 +1152,9 @@ int if_bct_is_t124_get_soc_config(build_image_context *context,
{
nvboot_config_table *bct = (nvboot_config_table *) context->bct;
+ if (context->bct_size < sizeof(nvboot_config_table))
+ return 0;
+
if (bct->boot_data_version == BOOTDATA_VERSION_T124) {
t124_get_soc_config(context, soc_config);
return 1;
@@ -1233,6 +1233,9 @@ int if_bct_is_t132_get_soc_config(build_image_context *context,
{
nvboot_config_table *bct = (nvboot_config_table *) context->bct;
+ if (context->bct_size < sizeof(nvboot_config_table))
+ return 0;
+
if (bct->boot_data_version == BOOTDATA_VERSION_T132) {
t132_get_soc_config(context, soc_config);
return 1;
@@ -719,6 +719,9 @@ int if_bct_is_t20_get_soc_config(build_image_context *context,
cbootimage_soc_config **soc_config)
{
nvboot_config_table * bct = (nvboot_config_table *) context->bct;
+
+ if (context->bct_size < sizeof(nvboot_config_table))
+ return 0;
if (bct->boot_data_version == BOOTDATA_VERSION_T20)
{
@@ -2306,6 +2306,9 @@ int if_bct_is_t210_get_soc_config(build_image_context *context,
{
nvboot_config_table *bct = (nvboot_config_table*) context->bct;
+ if (context->bct_size < sizeof(nvboot_config_table))
+ return 0;
+
if (bct->boot_data_version == BOOTDATA_VERSION_T210) {
t210_get_soc_config(context, soc_config);
return 1;
@@ -927,6 +927,9 @@ int if_bct_is_t30_get_soc_config(build_image_context *context,
{
nvboot_config_table * bct = (nvboot_config_table *) context->bct;
+ if (context->bct_size < sizeof(nvboot_config_table))
+ return 0;
+
if (bct->boot_data_version == BOOTDATA_VERSION_T30)
{
t30_get_soc_config(context, soc_config);
Checks if the BCT buffer is too small to be a valid `nvboot_config_table`. Signed-off-by: Giancarlo Canales Barreto <gcanalesb@me.com> --- src/t114/nvbctlib_t114.c | 3 +++ src/t124/nvbctlib_t124.c | 3 +++ src/t132/nvbctlib_t132.c | 3 +++ src/t20/nvbctlib_t20.c | 3 +++ src/t210/nvbctlib_t210.c | 3 +++ src/t30/nvbctlib_t30.c | 3 +++ 6 files changed, 18 insertions(+) -- 2.1.4