X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Flib%2Fefi.c;fp=src%2Flib%2Fefi.c;h=ac782c9b0edc4c3d5c7afc70f32579bfa04aea25;hb=d96a8f66c5fe2fac79073cc40e6f57f04c5bb4f1;hp=26c144a347bd6fcab745051466d5d543b8502021;hpb=c89d5f1e80b1582b6065b6f9a771b1c77f72c170;p=debian%2Fefibootmgr diff --git a/src/lib/efi.c b/src/lib/efi.c index 26c144a..ac782c9 100644 --- a/src/lib/efi.c +++ b/src/lib/efi.c @@ -20,8 +20,9 @@ #define _FILE_OFFSET_BITS 64 -typedef unsigned long long u64; /* hack to allow include of ethtool.h */ +typedef unsigned long long u64; /* hack to allow include of ethtool.h */ +#include #include #include #include @@ -173,9 +174,12 @@ create_or_edit_variable(efi_variable_t *var) static int select_boot_var_names(const struct dirent *d) { - int num, rc; - rc = sscanf(d->d_name, "Boot0%03x-%*s", &num); - return rc; + if (!strncmp(d->d_name, "Boot", 4) && + isxdigit(d->d_name[4]) && isxdigit(d->d_name[5]) && + isxdigit(d->d_name[6]) && isxdigit(d->d_name[7]) && + d->d_name[8] == '-') + return 1; + return 0; } int @@ -718,7 +722,7 @@ make_linux_efi_variable(efi_variable_t *var, memset(buffer, 0, sizeof(buffer)); /* VariableName needs to be BootXXXX */ - sprintf(buffer, "Boot%04x", free_number); + sprintf(buffer, "Boot%04X", free_number); efichar_from_char(var->VariableName, buffer, 1024);