1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-30 17:18:21 +03:00

daemon-stray: correct size limitation for filename

Correct the buffer size for filename printing.
This commit is contained in:
Zdenek Kabelac 2024-04-26 23:51:38 +02:00
parent b3189d9b15
commit d194fb8513

View File

@ -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';