From 170fb73b09f6628cc26624d77530986eb706b95c Mon Sep 17 00:00:00 2001 From: Maurizio Lombardi Date: Mon, 4 Mar 2024 15:05:15 +0100 Subject: [PATCH] fabrics: check the read() return value Do not pass to the is_dmi_uuid_valid() function an invalid len value if read() fails. Signed-off-by: Maurizio Lombardi --- src/nvme/fabrics.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/nvme/fabrics.c b/src/nvme/fabrics.c index 1f50229f..ac639bdf 100644 --- a/src/nvme/fabrics.c +++ b/src/nvme/fabrics.c @@ -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;