aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2018-10-26 22:49:25 +0000
committerWarner Losh <imp@FreeBSD.org>2018-10-26 22:49:25 +0000
commit46fabdaffccbbc39faeb69e42d4a89bc1531e96c (patch)
treef7fa4239f2ab79f7a459d924c566865f726302fc
parente08bb1091c785305ccf552e612019aa94ab1cc5b (diff)
downloadsrc-46fabdaffccbbc39faeb69e42d4a89bc1531e96c.tar.gz
src-46fabdaffccbbc39faeb69e42d4a89bc1531e96c.zip
Require that we have at least a device path header before
trying to decode the next device path. Sponsored by: Netflix, Inc
Notes
Notes: svn path=/head/; revision=339798
-rw-r--r--usr.sbin/efivar/efiutil.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/usr.sbin/efivar/efiutil.c b/usr.sbin/efivar/efiutil.c
index 786a1c41d499..a7dfc2474b04 100644
--- a/usr.sbin/efivar/efiutil.c
+++ b/usr.sbin/efivar/efiutil.c
@@ -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);
printf("%s", str);
free(str);
- while (dp < edp) {
+ while (dp < edp && (size_t)(edp - dp) > sizeof(efidp_header)) {
efidp_format_device_path(buf, sizeof(buf), dp,
(intptr_t)(void *)edp - (intptr_t)(void *)dp);
dp = (efidp)((char *)dp + efidp_size(dp));