From 3cde36ffa39bd96ef155afa1cb94e56f691f2bf2 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Tue, 22 Nov 2022 15:53:02 +0100 Subject: gpt: Specify designator array sizes explicitly Avoid users accidentally accessing uninitialized memory by always making sure the array size covers all possible enum values. --- src/shared/gpt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/shared/gpt.c b/src/shared/gpt.c index ce73d7f781..bcf690d077 100644 --- a/src/shared/gpt.c +++ b/src/shared/gpt.c @@ -59,7 +59,7 @@ PartitionDesignator partition_verity_sig_of(PartitionDesignator p) { } -static const char *const partition_designator_table[] = { +static const char *const partition_designator_table[_PARTITION_DESIGNATOR_MAX] = { [PARTITION_ROOT] = "root", [PARTITION_USR] = "usr", [PARTITION_HOME] = "home", @@ -79,7 +79,7 @@ static const char *const partition_designator_table[] = { DEFINE_STRING_TABLE_LOOKUP(partition_designator, PartitionDesignator); -static const char *const partition_mountpoint_table[] = { +static const char *const partition_mountpoint_table[_PARTITION_DESIGNATOR_MAX] = { [PARTITION_ROOT] = "/\0", [PARTITION_USR] = "/usr\0", [PARTITION_HOME] = "/home\0", -- cgit v1.2.3