From: Jan Kiszka <[email protected]> Better safe than sorry: If the env file is shorter than BG_ENVDATA, bail out early rather than just relying on the CRC32 check to catch this.
Signed-off-by: Jan Kiszka <[email protected]> --- env/fatvars.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/env/fatvars.c b/env/fatvars.c index ca15f5e..7572e83 100644 --- a/env/fatvars.c +++ b/env/fatvars.c @@ -135,7 +135,8 @@ BG_STATUS load_config(BG_LOADER_PARAMS *bglp) continue; } UINTN readlen = sizeof(BG_ENVDATA); - if (EFI_ERROR(read_cfg_file(fh, &readlen, (VOID *)&env[i]))) { + if (EFI_ERROR(read_cfg_file(fh, &readlen, (VOID *)&env[i])) || + readlen < sizeof(BG_ENVDATA)) { ERROR(L"Cannot read environment from config partition %d.\n", i); env_invalid[i] = 1; if (EFI_ERROR(close_cfg_file(v->root, fh))) { -- 2.34.1 -- You received this message because you are subscribed to the Google Groups "EFI Boot Guard" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/efibootguard-dev/e744b593-83dc-049b-0cae-ff3be01e35c3%40siemens.com.
