Skip to content

Commit

Permalink
fabrics: check the read() return value
Browse files Browse the repository at this point in the history
Do not pass to the is_dmi_uuid_valid() function an invalid len value
if read() fails.

Signed-off-by: Maurizio Lombardi <[email protected]>
  • Loading branch information
maurizio-lombardi authored and igaw committed Mar 5, 2024
1 parent 3bf34a6 commit dd22963
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/nvme/fabrics.c
Original file line number Diff line number Diff line change
Expand Up @@ -1297,6 +1297,8 @@ static int uuid_from_dmi_entries(char *system_uuid)
continue;
len = read(f, buf, 512);
close(f);
if (len <= 0)
continue;

if (!is_dmi_uuid_valid(buf, len))
continue;
Expand Down

0 comments on commit dd22963

Please sign in to comment.