Fix pointer arithmetic botch.
Pointer subtraction to find size only works with char pointers. Noticed by: jhb@ Sponsored by: Netflix, Inc
This commit is contained in:
parent
df65fbc569
commit
92f9212ba6
@ -116,6 +116,8 @@ bindump(uint8_t *data, size_t datalen)
|
||||
|
||||
#define LOAD_OPTION_ACTIVE 1
|
||||
|
||||
#define SIZE(dp, edp) (size_t)((intptr_t)(void *)edp - (intptr_t)(void *)dp)
|
||||
|
||||
void
|
||||
efi_print_load_option(uint8_t *data, size_t datalen, int Aflag, int bflag, int uflag)
|
||||
{
|
||||
@ -159,9 +161,8 @@ 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 && (size_t)(edp - dp) > sizeof(efidp_header)) {
|
||||
efidp_format_device_path(buf, sizeof(buf), dp,
|
||||
(intptr_t)(void *)edp - (intptr_t)(void *)dp);
|
||||
while (dp < edp && SIZE(dp, edp) > sizeof(efidp_header)) {
|
||||
efidp_format_device_path(buf, sizeof(buf), dp, SIZE(dp, edp));
|
||||
dp = (efidp)((char *)dp + efidp_size(dp));
|
||||
printf(" %s\n", buf);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user