summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sbat.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/sbat.c b/sbat.c
index 2bddbce2..e996a419 100644
--- a/sbat.c
+++ b/sbat.c
@@ -70,24 +70,19 @@ error:
EFI_STATUS
parse_sbat(char *sbat_base, size_t sbat_size, struct sbat *sbat)
{
- CHAR8 *current = (CHAR8 *)sbat_base;
- CHAR8 *end = (CHAR8 *)sbat_base + sbat_size;
+ CHAR8 *current = (CHAR8 *) sbat_base;
+ CHAR8 *end = (CHAR8 *) sbat_base + sbat_size - 1;
EFI_STATUS efi_status = EFI_SUCCESS;
struct sbat_entry *entry;
struct sbat_entry **entries;
unsigned int i;
- while ((*current == '\r' || *current == '\n') && current < end)
- current++;
+ if (!sbat_base || !sbat || sbat_size == 0)
+ return EFI_INVALID_PARAMETER;
if (current == end)
return EFI_INVALID_PARAMETER;
- while ((*end == '\r' || *end == '\n') && end < current)
- end--;
-
- *(end - 1) = '\0';
-
do {
entry = NULL;
efi_status = parse_sbat_entry(&current, end, &entry);