[PATCH] uefibootpath: include the null-terminated space in device path length
Ivan Hu
ivan.hu at canonical.com
Thu Jan 15 07:59:07 UTC 2015
The UEFI spec defined some Device Path, such as the Description String on BIOS
Boot Specification Device Path as a null-terminated ASCII string that describes
the boot device to a user. Those null-terminated spaces need to be included to the device path length.
Signed-off-by: Ivan Hu <ivan.hu at canonical.com>
---
src/uefi/uefibootpath/uefibootpath.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/uefi/uefibootpath/uefibootpath.c b/src/uefi/uefibootpath/uefibootpath.c
index 1c11963..6c521e4 100644
--- a/src/uefi/uefibootpath/uefibootpath.c
+++ b/src/uefi/uefibootpath/uefibootpath.c
@@ -606,7 +606,7 @@ static int uefibootpath_check_dev_path(fwts_framework *fw, fwts_uefi_dev_path *d
"The length of File Path Media Device Path is %" PRIu16 " bytes "
"is not matching with adding the length of Path String %" PRIu16 " bytes.",
len,
- (uint16_t)(sizeof(fwts_uefi_file_path_dev_path) + (fwts_uefi_str16len(f->path_name) * sizeof(uint16_t))));
+ (uint16_t)(sizeof(fwts_uefi_file_path_dev_path) + ((fwts_uefi_str16len(f->path_name) + 1) * sizeof(uint16_t))));
errors++;
break;
}
@@ -660,12 +660,12 @@ static int uefibootpath_check_dev_path(fwts_framework *fw, fwts_uefi_dev_path *d
break;
}
fwts_uefi_bios_dev_path *b = (fwts_uefi_bios_dev_path *)dev_path;
- if (len != (sizeof(fwts_uefi_bios_dev_path) + strlen(b->description))) {
+ if (len != (sizeof(fwts_uefi_bios_dev_path) + strlen(b->description) + 1)) {
fwts_failed(fw, LOG_LEVEL_MEDIUM, "UEFIBiosBootDevPathLength",
"The length of BIOS Boot Specification Device Path is %" PRIu16 " bytes "
"is not matching with adding the length of Description String %" PRIu16 " bytes.",
len,
- (uint16_t)(sizeof(fwts_uefi_bios_dev_path) + strlen(b->description)));
+ (uint16_t)(sizeof(fwts_uefi_bios_dev_path) + strlen(b->description) + 1));
errors++;
}
break;
--
1.7.9.5
More information about the fwts-devel
mailing list