This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: PATCH: fix buffer overrun in natFile.cc


>>>>> "Bryce" == Bryce McKinlay <bryce@waitaki.otago.ac.nz> writes:

Bryce> Anyhow, can we get away with a stack allocation (ie char[sizeof(...)
Bryce> + NAME_MAX +1];) instead of the malloc? Shouldn't NAME_MAX always be
Bryce> available, at least wherever readdir_r is?

We should definitely use stack allocation.

I don't know about NAME_MAX though.  The glibc manual says it is
defined in limits.h.  I wonder what older systems did.  Using
pathconf() definitely won't work everywhere.  But chances are that,
aside from newlib-based cross builds, libgcj won't build on any of
those systems anyway.  (Actually I don't know whether newlib has
pathconf() or not.)

Bryce> For simplicity it might be worth dropping the _JV_POSIX_THREADS
Bryce> test and just using HAVE_READDIR_R.

I agree.

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]