]> sourceware.org Git - lvm2.git/commitdiff
daemon-stray: correct size limitation for filename
authorZdenek Kabelac <zkabelac@redhat.com>
Fri, 26 Apr 2024 21:51:38 +0000 (23:51 +0200)
committerZdenek Kabelac <zkabelac@redhat.com>
Fri, 26 Apr 2024 21:51:38 +0000 (23:51 +0200)
Correct the buffer size for filename printing.

libdaemon/server/daemon-stray.h

index 080b14aebeac4fc571bec005f1ca97003e72b22d..cfce85622a682b503658e9ed6d492ce4c7c090aa 100644 (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';
This page took 0.04231 seconds and 5 git commands to generate.