]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lsfd: handle unexpected values read from /proc/PID/syscall
authorMasatake YAMATO <yamato@redhat.com>
Fri, 17 Apr 2026 21:38:20 +0000 (06:38 +0900)
committerMasatake YAMATO <yamato@redhat.com>
Fri, 17 Apr 2026 21:40:10 +0000 (06:40 +0900)
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
lsfd-cmd/lsfd.c

index 4991ce1bf3fcebd358963b12d462b779f3a26e58..ca4c91b9a81844f3181f5276169c8ec45bc793bd 100644 (file)
@@ -1942,7 +1942,8 @@ static void mark_poll_fds_as_multiplexed(char *buf,
        if (sscanf(buf, "%lx %lx", &fds, &nfds) != 2)
                return;
 
-       if (nfds == 0)
+       if (nfds <= 0)
+               /* Unexpected value */
                return;
 
        local.iov_len = sizeof(struct pollfd) * nfds;
@@ -1987,7 +1988,8 @@ static void mark_select_fds_as_multiplexed(char *buf,
        if (sscanf(buf, "%lx %lx %lx %lx", &nfds, fds + 0, fds + 1, fds + 2) != 4)
                return;
 
-       if (nfds == 0)
+       if (nfds <= 0)
+               /* Unexpected value */
                return;
 
        for (int i = 0; i < 3; i++) {