diff options
| author | Peter Jones <pjones@redhat.com> | 2021-03-11 17:20:52 -0500 |
|---|---|---|
| committer | Javier Martinez Canillas <javier@dowhile0.org> | 2021-03-12 10:15:01 +0100 |
| commit | 2a2ae40523fc9c735771ee3a4acfb866fdf0e586 (patch) | |
| tree | 5f2f57b3c7ded3b2ae5b433b52b76996f4efdbdf /sbat.c | |
| parent | b3b518509230b94c901913e8ab5602e4a9ae4c10 (diff) | |
| download | efi-boot-shim-2a2ae40523fc9c735771ee3a4acfb866fdf0e586.tar.gz efi-boot-shim-2a2ae40523fc9c735771ee3a4acfb866fdf0e586.zip | |
set_sbat_uefi_variable(): align some decisions that are off-by-one.
Fix a couple of small off-by-one errors in the SBAT variable initial
setup and validation path.
Signed-off-by: Peter Jones <pjones@redhat.com>
Diffstat (limited to 'sbat.c')
| -rw-r--r-- | sbat.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -324,8 +324,8 @@ set_sbat_uefi_variable(void) if (EFI_ERROR(efi_status)) { dprint(L"SBAT read failed %r\n", efi_status); } else if (check_sbat_var_attributes(attributes) && - sbatsize >= strlen(SBAT_VAR_SIG "1") && - strncmp((const char *)sbat, SBAT_VAR_SIG, + sbatsize >= strlen(SBAT_VAR_SIG "1") && + strncmp((const char *)sbat, SBAT_VAR_SIG, strlen(SBAT_VAR_SIG))) { dprint("SBAT variable is %d bytes, attributes are 0x%08x\n", sbatsize, attributes); @@ -348,7 +348,7 @@ set_sbat_uefi_variable(void) /* set variable */ efi_status = set_variable(SBAT_VAR_NAME, SHIM_LOCK_GUID, SBAT_VAR_ATTRS, - sizeof(SBAT_VAR), SBAT_VAR); + sizeof(SBAT_VAR)-1, SBAT_VAR); if (EFI_ERROR(efi_status)) { dprint(L"SBAT variable writing failed %r\n", efi_status); return efi_status; |
