From: Masatake YAMATO Date: Fri, 17 Apr 2026 21:38:20 +0000 (+0900) Subject: lsfd: handle unexpected values read from /proc/PID/syscall X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=a1de02170fc76ec16db53cb53feab5e4d2cc2fc3;p=thirdparty%2Futil-linux.git lsfd: handle unexpected values read from /proc/PID/syscall Signed-off-by: Masatake YAMATO --- diff --git a/lsfd-cmd/lsfd.c b/lsfd-cmd/lsfd.c index 4991ce1bf..ca4c91b9a 100644 --- a/lsfd-cmd/lsfd.c +++ b/lsfd-cmd/lsfd.c @@ -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++) {