Skip to content

Commit

Permalink
Fix undefined-behavior in osquery::tables::getCanonicalEfiDevicePath
Browse files Browse the repository at this point in the history
Issue highlighted by asan activated in PR osquery#5628

EFI_DEVICE_PATH_PROTOCOL and HARDDRIVE_DEVICE_PATH were using
the wrong alignment/padding, since on disk they are written
with no padding.

PR: osquery#5665
  • Loading branch information
Smjert committed Jul 30, 2019
1 parent b6960c4 commit 986e19d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions osquery/tables/system/efi_misc.h
Expand Up @@ -12,6 +12,7 @@
/**
* @brief EFI DevicePath GUIDs, structs, and macros.
*/
#pragma pack(push, 1)
typedef struct {
uint8_t Type;
uint8_t SubType;
Expand All @@ -27,6 +28,7 @@ typedef struct {
uint8_t MBRType;
uint8_t SignatureType;
} HARDDRIVE_DEVICE_PATH;
#pragma pack(pop)

#define EFI_END_ENTIRE_DEVICE_PATH 0xff
#define EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE 0xff
Expand Down

0 comments on commit 986e19d

Please sign in to comment.