On Mon, Apr 30, 2018 at 03:29:39PM +1000, Patrick Oppenlander wrote: > On Mon, Apr 30, 2018 at 1:16 PM, Rich Felker wrote: > > On Mon, Apr 30, 2018 at 12:52:06PM +1000, Patrick Oppenlander wrote: > >> - getcwd returned buffer size can be incorrect. If you call > >> getcwd(NULL, 1234) the returned buffer is sized to match the path > >> length but should be 1234 to be compatible with the glibc extension. > > > > I'll look at this. It seems like a worse behavior for most callers, > > but maybe it should match. > > Actually, my biggest issue with getcwd is that it allocates a PATH_MAX > sized buffer on the stack. That's painful on deeply embedded stuff. That's unrelated, and could/should be fixed by the attached patch I think. Rich