diff options
author | Daan De Meyer <daan.j.demeyer@gmail.com> | 2022-11-22 15:53:02 +0100 |
---|---|---|
committer | Daan De Meyer <daan.j.demeyer@gmail.com> | 2022-11-22 15:53:02 +0100 |
commit | 3cde36ffa39bd96ef155afa1cb94e56f691f2bf2 (patch) | |
tree | 6e2a5215dcb6d1bf60a607a2dec58e053191b3b4 /src | |
parent | resolved: Fix OpenSSL error messages (diff) | |
download | systemd-3cde36ffa39bd96ef155afa1cb94e56f691f2bf2.tar.xz systemd-3cde36ffa39bd96ef155afa1cb94e56f691f2bf2.zip |
gpt: Specify designator array sizes explicitly
Avoid users accidentally accessing uninitialized memory by always
making sure the array size covers all possible enum values.
Diffstat (limited to 'src')
-rw-r--r-- | src/shared/gpt.c | 4 |
1 files changed, 2 insertions, 2 deletions
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", |