]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream: When poll(2) returns -1, for some error conditions
authorderaadt@openbsd.org <deraadt@openbsd.org>
Fri, 21 Jan 2022 00:53:40 +0000 (00:53 +0000)
committerDamien Miller <djm@mindrot.org>
Mon, 24 Jan 2022 23:33:03 +0000 (10:33 +1100)
pfd[].revents is not cleared.  There are subtle errors in various programs.
In this particular case, the program should error out. ok djm millert

OpenBSD-Commit-ID: 00f839b16861f7fb2adcf122e95e8a82fa6a375c

ssh-keyscan.c

index 3480f8f0011413ddfeddbfa4ec5a399c701d3f03..d29a03b4e68a82772010786f5b93dd50cbc86cb9 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-keyscan.c,v 1.144 2021/12/02 23:45:36 djm Exp $ */
+/* $OpenBSD: ssh-keyscan.c,v 1.145 2022/01/21 00:53:40 deraadt Exp $ */
 /*
  * Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>.
  *
@@ -592,9 +592,11 @@ conloop(void)
        else
                timespecclear(&seltime);
 
-       while (ppoll(read_wait, maxfd, &seltime, NULL) == -1 &&
-           (errno == EAGAIN || errno == EINTR || errno == EWOULDBLOCK))
-               ;
+       while (ppoll(read_wait, maxfd, &seltime, NULL) == -1) {
+               if (errno == EAGAIN || errno == EINTR || errno == EWOULDBLOCK)
+                       continue;
+               error("poll error");
+       }
 
        for (i = 0; i < maxfd; i++) {
                if (read_wait[i].revents & (POLLHUP|POLLERR|POLLNVAL))