NetBSD-Bugs archive

[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: Kamil Rytarowski <n54%gmx.com@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: lib/53640: getnstr(3) shall read at most n characters, not n-1
Date: Sat, 29 Sep 2018 16:05:39 +0200

 This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
 --ZXq0EQK9iZ25bBlNKm5DwTpayhFsPikuj
 Content-Type: multipart/mixed; boundary="36REnFaNY8tPmPzV85wqQqntaJVaaTb6w";
  protected-headers="v1"
 From: Kamil Rytarowski <n54%gmx.com@localhost>
 To: gnats-bugs%NetBSD.org@localhost
 Message-ID: <cf248882-d54d-b60f-da5a-a3077a363726%gmx.com@localhost>
 Subject: Re: lib/53640: getnstr(3) shall read at most n characters, not n-1
 References: <pr-lib-53640%gnats.netbsd.org@localhost>
  <20180929102931.2AB207A232%mollari.NetBSD.org@localhost>
  <20180929135001.4DC9B7A276%mollari.NetBSD.org@localhost>
 In-Reply-To: <20180929135001.4DC9B7A276%mollari.NetBSD.org@localhost>
 
 --36REnFaNY8tPmPzV85wqQqntaJVaaTb6w
 Content-Type: text/plain; charset=utf-8
 Content-Language: en-US
 Content-Transfer-Encoding: quoted-printable
 
 On 29.09.2018 15:50, Valery Ushakov wrote:
 > The following reply was made to PR lib/53640; it has been noted by GNAT=
 S.
 >=20
 > From: Valery Ushakov <uwe%stderr.spb.ru@localhost>
 > To: gnats-bugs%NetBSD.org@localhost
 > Cc:=20
 > Subject: Re: lib/53640: getnstr(3) shall read at most n characters, not=
  n-1
 > Date: Sat, 29 Sep 2018 16:46:42 +0300
 >=20
 >  On Sat, Sep 29, 2018 at 10:30:01 +0000, n54%gmx.com@localhost wrote:
 > =20
 >  > It's documented in POSIX to reat at most N bytes; but the NetBSD
 >  > curses(3) version reads at most N-1 bytes.
 >  >=20
 >  > http://pubs.opengroup.org/onlinepubs/7908799/xcurses/getnstr.html
 > =20
 >  I don't think that definition is precise enough.  It doesn't
 >  explicitly say if the buffer is NUL terminated on overflow.
 > =20
 
 It's specified that the input string is terminated by a \0 byte.
 
 "The resulting value is placed in the area pointed to by str. The string
 is then terminated with a null byte. "
 
 In combination of "functions read at most n bytes" I assume that I can
 enter n characters (bytes) and a string is always terminated with a NUL
 character.
 
 > =20
 >  > While the NetBSD curses(3) behavior might be defendable it diverges
 >  > from the idiom of gets(3) + fgets(3). fgets(3) is documented to read=
 
 >  > at most N-1 characters and it does so.
 > =20
 >  > >How-To-Repeat:
 > =20
 >  Is it really that hard to explicitly quote the results you observe
 >  with these tests?  I find it rather disingenuous.  Can't you
 >  explicitly state your point?
 > =20
 
 This is an interactive program. You cannot enter N characters into it,
 only up to N-1.
 
 NetBSD curses(3) permits to enter only up to n-1 characters (bytes),
 while ncurses allows n.
 
 POSIX specifies that we shall be able read up to n bytes.
 
 > =20
 >  -uwe
 > =20
 >=20
 
 
 
 --36REnFaNY8tPmPzV85wqQqntaJVaaTb6w--
 
 --ZXq0EQK9iZ25bBlNKm5DwTpayhFsPikuj
 Content-Type: application/pgp-signature; name="signature.asc"
 Content-Description: OpenPGP digital signature
 Content-Disposition: attachment; filename="signature.asc"
 
 -----BEGIN PGP SIGNATURE-----
 
 iQJABAEBCAAqFiEELaxVpweEzw+lMDwuS7MI6bAudmwFAluvhrkMHG41NEBnbXgu
 Y29tAAoJEEuzCOmwLnZs+ZwP/3n+HBGzruhtEvf8gVGH9vjaBPV+GFdlFV+3Grj/
 MThzslDOFD0oLrFA4UQCUZx0NjabGeUc/9lgbTxaoJJusMBKJy/fra7GvUEj0HBI
 pxS7OY8ATH22RDHQFBC/YUOgZN4+kLloCRxkVFRRc8vADnlaDGx7ZCb+B15tDLhC
 XYajnaVCQqomU296ysc5PMPBnFf7YCNS07Ogx+N+livFUfuX3T+h869N8rfqbk2r
 4KFscm2Ajgm6ZFS5ZcuJ9llN2L3vZwuR9+sTvaIDq4Mlwb+amQoMBkfZFC5LOhnQ
 kvkflOLV2IbiEwBzWTjlZFgQRMLbbnFaYsraVI2RrcX2fQGe21mUJVvdTJYyxPOn
 mTdQfXhhq3qsT47s6cofnVSB43VfBSIdvVp7/uPM+L8pV1s6MiJ0X9wXZpqFgGoc
 TQ6eiYjs/V8E2PU9AarjdADiqnxQg3iWR4VGHNVgooeUsHxLp7K/zxEnoafU7ctY
 /jnfgYJVA6w2OtpOCJhKtIuM4ldM8ocJ2TLcTikPN5wPU5Jqov2MOnH7na73UPpw
 tXAfhdpPhkShKP7YYHv1dfJ7jtSzCMuZTM8pAk9Poc5Es32PyAW8SddWsWI5LJAu
 BogiwA4adDun0p87bK4ypObZc7cQAyjOTTFWg+LrjzmuC3dD/mxYZpXLGdmN0757
 d/8g
 =xf8x
 -----END PGP SIGNATURE-----
 
 --ZXq0EQK9iZ25bBlNKm5DwTpayhFsPikuj--
 


Home | Main Index | Thread Index | Old Index