nixpkgs/pkgs/tools/system/efibootmgr/arbitrary-filenames.patch

25 lines
979 B
Diff
Raw Normal View History

diff -Naur efibootmgr-0.5.4-orig/src/lib/efi.c efibootmgr-0.5.4/src/lib/efi.c
--- efibootmgr-0.5.4-orig/src/lib/efi.c 2008-01-03 15:34:01.000000000 +0100
+++ efibootmgr-0.5.4/src/lib/efi.c 2012-03-13 22:25:51.000000000 +0100
@@ -495,7 +495,8 @@
int rc, edd_version=0;
uint8_t mbr_type=0, signature_type=0;
uint64_t start=0, size=0;
- efi_char16_t os_loader_path[40];
+ efi_char16_t *os_loader_path;
+ size_t os_loader_path_size;
memset(signature, 0, sizeof(signature));
@@ -535,7 +536,9 @@
signature,
mbr_type, signature_type);
- efichar_from_char(os_loader_path, opts.loader, sizeof(os_loader_path));
+ os_loader_path_size = sizeof(efi_char16_t) * (1 + strlen(opts.loader) / sizeof(char));
+ os_loader_path = malloc(os_loader_path_size);
+ efichar_from_char(os_loader_path, opts.loader, os_loader_path_size);
p += make_file_path_device_path (p, os_loader_path);
p += make_end_device_path (p);