On Mon, Apr 27, 2026 at 09:12:26AM +0200, Dr. Werner Fink wrote:
> Hi,
> 
> I have a report that in ncurses/tty/lib_twait.c around line 286 there
> is Off-by-one Buffer Error:
> 
> 
> ```
> for (c = 0; c < count; c++)
>     if (fds[count].revents & POLLNVAL) {
              ^^^^^ (should be 'c')
>         errno = EBADF;
>     } else if (fds[c].fd == ev->data.fev.fd
>                && fds[c].revents & POLLIN) {
>         // ...
>     }
> ```
> 
> even if this report is not valid it would help the readers to move
> the fds[count] before the loop.

yes... I'm puzzled that the test is actually succeeding (setting errno
to EBADF when it "should" -- but changing the variable does work, too)

-- 
Thomas E. Dickey <[email protected]>
https://invisible-island.net

Attachment: signature.asc
Description: PGP signature

Reply via email to