Remove VLAs from UUID block parsing code.

This commit is contained in:
Milan Broz
2021-02-13 22:22:26 +01:00
parent 20320dfd0e
commit 2d9c0b507d
5 changed files with 11 additions and 15 deletions

View File

@@ -406,10 +406,10 @@ int lookup_by_disk_id(const char *dm_uuid)
return r;
}
int lookup_by_sysfs_uuid_field(const char *dm_uuid, size_t max_len)
int lookup_by_sysfs_uuid_field(const char *dm_uuid)
{
struct dirent *entry;
char subpath[PATH_MAX], uuid[max_len];
char subpath[PATH_MAX], uuid[DM_UUID_LEN];
ssize_t s;
struct stat st;
int fd, len, r = 0; /* not found */
@@ -441,7 +441,7 @@ int lookup_by_sysfs_uuid_field(const char *dm_uuid, size_t max_len)
}
/* reads binary data */
s = read_buffer(fd, uuid, max_len - 1);
s = read_buffer(fd, uuid, sizeof(uuid) - 1);
if (s > 0) {
uuid[s] = '\0';
if (!strncmp(uuid, dm_uuid, strlen(dm_uuid)))