From f443d16fd7409b46b77be2aa74090ab558c51425 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Tue, 20 Dec 2022 13:58:31 +0100 Subject: [PATCH] cov: fix buffer size usage Count with extra 1 byte for buffer end '\0'. --- libdm/dm-tools/dmfilemapd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdm/dm-tools/dmfilemapd.c b/libdm/dm-tools/dmfilemapd.c index d547e59d5..f6c04e03e 100644 --- a/libdm/dm-tools/dmfilemapd.c +++ b/libdm/dm-tools/dmfilemapd.c @@ -172,7 +172,7 @@ static int _is_open_in_pid(pid_t pid, const char *path) if (pid_dp->d_name[0] == '.') continue; if ((len = readlinkat(dirfd(pid_d), pid_dp->d_name, link_buf, - sizeof(link_buf))) < 0) { + (sizeof(link_buf) - 1))) < 0) { log_error("readlink failed for " DEFAULT_PROC_DIR "/%d/fd/.", pid); goto bad;