Require that we have at least a device path header before

trying to decode the next device path.

Sponsored by: Netflix, Inc
This commit is contained in:
Warner Losh 2018-10-26 22:49:25 +00:00
parent e08bb1091c
commit 46fabdaffc

View File

@ -159,7 +159,7 @@ efi_print_load_option(uint8_t *data, size_t datalen, int Aflag, int bflag, int u
ucs2_to_utf8(descr, &str); ucs2_to_utf8(descr, &str);
printf("%s", str); printf("%s", str);
free(str); free(str);
while (dp < edp) { while (dp < edp && (size_t)(edp - dp) > sizeof(efidp_header)) {
efidp_format_device_path(buf, sizeof(buf), dp, efidp_format_device_path(buf, sizeof(buf), dp,
(intptr_t)(void *)edp - (intptr_t)(void *)dp); (intptr_t)(void *)edp - (intptr_t)(void *)dp);
dp = (efidp)((char *)dp + efidp_size(dp)); dp = (efidp)((char *)dp + efidp_size(dp));