From 6001df659464506990d98efe109288b78438d3e7 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 12 May 2021 10:16:36 +0900 Subject: [PATCH] gpt: introduce GPT_LAVEL_MAX --- src/shared/gpt.c | 2 +- src/shared/gpt.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/shared/gpt.c b/src/shared/gpt.c index 558b69c487..bd1f43ffdd 100644 --- a/src/shared/gpt.c +++ b/src/shared/gpt.c @@ -104,7 +104,7 @@ int gpt_partition_label_valid(const char *s) { if (!recoded) return -ENOMEM; - return char16_strlen(recoded) <= 36; + return char16_strlen(recoded) <= GPT_LABEL_MAX; } bool gpt_partition_type_is_root(sd_id128_t id) { diff --git a/src/shared/gpt.h b/src/shared/gpt.h index 6581973793..c92d9c0974 100644 --- a/src/shared/gpt.h +++ b/src/shared/gpt.h @@ -115,6 +115,9 @@ #define GPT_FLAG_NO_AUTO (1ULL << 63) #define GPT_FLAG_GROWFS (1ULL << 59) +/* maximum length of gpt label */ +#define GPT_LABEL_MAX 36 + const char *gpt_partition_type_uuid_to_string(sd_id128_t id); const char *gpt_partition_type_uuid_to_string_harder( sd_id128_t id,