Commit graph

8 commits

Author SHA1 Message Date
Peter Jones
f725fa7cb2 calloc: Use calloc() at most places
This modifies most of the places we do some form of:

  X = malloc(Y * Z);

to use calloc(Y, Z) instead.

Among other issues, this fixes:
  - allocation of integer overflow in grub_png_decode_image_header()
    reported by Chris Coulson,
  - allocation of integer overflow in luks_recover_key()
    reported by Chris Coulson,
  - allocation of integer overflow in grub_lvm_detect()
    reported by Chris Coulson.

Fixes: CVE-2020-14308

Signed-off-by: Peter Jones <pjones@redhat.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2020-07-29 16:55:47 +02:00
Vladimir Serbinenko
41121742df windows/platform.c: Fix compilation errors 2019-03-07 14:19:27 +01:00
Andrei Borzenkov
a9399f2e1e windows: correct LBA in generated EFI HDD media paths
GRUB keeps partition offset and size in units of 512B sectors. Media paths
are defined in terms of LBA which are presumed to match HDD sector size.

This is probably cosmetic (EFI requires that partition is searched by GUID)
and still incorrect if GPT was created using different logical block size.
But current code is obviously wrong and new has better chances to be correct.
2015-12-19 11:32:49 +03:00
Andrey Borzenkov
a6e7719bbe fix EFI detection on Windows
We are on legacy BIOS if GetFirmwareEnvironmentVariable fails (returns
zero) *and* extended error information is ERROR_INVALID_FUNCTION.

Cf. http://msdn.microsoft.com/en-us/library/windows/desktop/ms724325%28v=vs.85%29.aspx
2013-12-25 22:36:28 +04:00
David Prévot
496a6b3024 Correct some translatable strings. 2013-12-21 03:03:31 +01:00
Vladimir Serbinenko
636977b089 Mark strings for translation and add remaining ones to exclude list. 2013-12-18 06:50:24 +01:00
Andrey Borzenkov
e477187bf4 small fixes for Windows EFI install code
Fix potential crash caused by signed vs. unsigned comparison. Negative
length compares as very large unsigned number causing subsequent NULL access.

Make exhaustive search for all BootNNNN variables to find one matching
requested efi_distributor.
2013-12-15 22:00:15 +04:00
Vladimir Serbinenko
814442ba69 Implement windows flavour of EFI install routines. 2013-12-14 23:35:58 +01:00