summaryrefslogtreecommitdiffstats
path: root/platform-intel.h
diff options
context:
space:
mode:
authorKinga Tanska <kinga.tanska@intel.com>2023-05-11 04:55:13 +0200
committerJes Sorensen <jes@trained-monkey.org>2023-09-01 18:09:07 +0200
commit5ccd457b29809bee442749b5f66ac27ebba4a72d (patch)
tree15f56f0b9e5c82a9298c04591f0c1c4333c6ea1d /platform-intel.h
parentFix unsafe string functions (diff)
downloadmdadm-5ccd457b29809bee442749b5f66ac27ebba4a72d.tar.xz
mdadm-5ccd457b29809bee442749b5f66ac27ebba4a72d.zip
platform-intel: limit guid length
Moving GUID_STR_MAX to header to use it as a length limitation for snprintf function. Signed-off-by: Kinga Tanska <kinga.tanska@intel.com> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
Diffstat (limited to 'platform-intel.h')
-rw-r--r--platform-intel.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/platform-intel.h b/platform-intel.h
index 2c0f4e39..ba97fb04 100644
--- a/platform-intel.h
+++ b/platform-intel.h
@@ -19,6 +19,9 @@
#include <asm/types.h>
#include <strings.h>
+/* according to GUID format: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" */
+#define GUID_STR_MAX 37
+
/* The IMSM Capability (IMSM AHCI and ISCU OROM/EFI variable) Version Table definition */
struct imsm_orom {
__u8 signature[4];
@@ -229,7 +232,7 @@ extern struct orom_entry *orom_entries;
static inline char *guid_str(char *buf, struct efi_guid guid)
{
- sprintf(buf, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+ snprintf(buf, GUID_STR_MAX, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
guid.b[3], guid.b[2], guid.b[1], guid.b[0],
guid.b[5], guid.b[4], guid.b[7], guid.b[6],
guid.b[8], guid.b[9], guid.b[10], guid.b[11],