From 4c9654fb68dcdb0a489982570e4613f9fad2fc92 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Wed, 17 Feb 2021 14:03:01 +0100 Subject: [PATCH] sbat: include NULL terminator when calculating buffer end in parse_sbat() The parse_sbat() function is currently removing the last character of the passed buffer, which will usually be a null-terminated string to parse. There's no reason to do this and just take the whole size as specified by the caller. Reported-by: Chris Coulson Signed-off-by: Javier Martinez Canillas --- sbat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbat.c b/sbat.c index a917b0f..5bda597 100644 --- a/sbat.c +++ b/sbat.c @@ -89,7 +89,7 @@ EFI_STATUS parse_sbat(char *sbat_base, size_t sbat_size, size_t *sbats, struct sbat_entry ***sbat) { CHAR8 *current = (CHAR8 *)sbat_base; - CHAR8 *end = (CHAR8 *)sbat_base + sbat_size - 1; + CHAR8 *end = (CHAR8 *)sbat_base + sbat_size; EFI_STATUS efi_status = EFI_SUCCESS; struct sbat_entry *entry = NULL; struct sbat_entry **entries;