From d194fb8513c83b0aad5a735693d34716be23eb7c Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Fri, 26 Apr 2024 23:51:38 +0200 Subject: [PATCH] daemon-stray: correct size limitation for filename Correct the buffer size for filename printing. --- libdaemon/server/daemon-stray.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdaemon/server/daemon-stray.h b/libdaemon/server/daemon-stray.h index 080b14aeb..cfce85622 100644 --- a/libdaemon/server/daemon-stray.h +++ b/libdaemon/server/daemon-stray.h @@ -64,7 +64,7 @@ static void _daemon_get_filename(int fd, char *filename, size_t size) snprintf(buf, sizeof(buf), DEFAULT_PROC_DIR "/self/fd/%u", fd); - if ((lsize = readlink(buf, filename, sizeof(filename) - 1)) == -1) + if ((lsize = readlink(buf, filename, size - 1)) == -1) filename[0] = '\0'; else filename[lsize] = '\0';