On Sun, May 15, 2022 at 07:31:55PM -0400, Rich Felker wrote: > On Thu, May 12, 2022 at 10:08:37AM -0400, Rich Felker wrote: > > A few other changes I think should be made: > > > > [...] > > > > - The n[] array should be changed to size_t[] and the %n's to %zn's. > > This should actually be done as a separate change, as it's a fix for > > a bug overlooked when 05973dc3bbc1aca9b3c8347de6879ed72147ab3b made > > the buffer length potentially longer than INT_MAX. > > I'm going to reverse position on this: since getmntent_r only accepts > an int for the line length, the thread-unsafe getmntent should not be > able to process longer lines either. I'll instead just use the len you > already computed to treat lines longer than INT_MAX as invalid. Makes sense.