[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: lib/53640: getnstr(3) shall read at most n characters, not n-1
The following reply was made to PR lib/53640; it has been noted by GNATS.
From: Valery Ushakov <uwe%stderr.spb.ru@localhost>
Subject: Re: lib/53640: getnstr(3) shall read at most n characters, not n-1
Date: Fri, 22 Mar 2019 00:41:40 +0300
On Sat, Sep 29, 2018 at 18:29:35 +0300, Valery Ushakov wrote:
> On Sat, Sep 29, 2018 at 14:05:00 +0000, Kamil Rytarowski wrote:
> > > On Sat, Sep 29, 2018 at 10:30:01 +0000, n54%gmx.com@localhost wrote:
> > >
> > > > It's documented in POSIX to reat at most N bytes; but the NetBSD
> > > > curses(3) version reads at most N-1 bytes.
> > > >
> > > > http://pubs.opengroup.org/onlinepubs/7908799/xcurses/getnstr.html
> Given the overall confusion that usually surrounds these kinds of "n"
> functions, it would be better that this kind of details is specified
> as explicitly as possible.
> As I said in my previous reply, all manual pages for this suck in one
> way or another and I still think NetBSD behavior seems globally
> correct (POSIX wording notwithstanding).
Just for the record. X/Open Curses, Issue 7 says:
The getnstr(), mvgetnstr(), mvwgetnstr(), and wgetnstr() functions
are equivalent to the getstr(), mvgetstr(), mvwgetstr(), and
wgetstr() functions respectively, except that they read at most N-1
bytes, thus preventing a possible overflow of the input buffer.
Main Index |
Thread Index |