aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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));