On Wed, 2007-10-03 at 14:31 +0200, Eli Zaretskii wrote: > To be on the safe side with this issue, we really need to call > pathconf to get the correct values. (It will need to be emulated on > Windows, but that isn't hard, at least as far as _POSIX_PATH_MAX and > _POSIX_NAME_MAX are concerned.) If pathconf returns something greater > than a few KB, I'd suggest to avoid alloca or any other stack-based > allocations.
The thing is, even if pathnames are ALLOWED to be very long, the chances that they actually ARE very long are exceedingly slim (especially for GNU make, which generally deals with real files in real directories rather than artificially created ones). So, alloca() is a good fit... except in those very, very, VERY rare situations where it's not. And, as has been pointed out, using a char x[MAXPATHLEN] is even more susceptible to stack overflow as alloca()... or else it's susceptible to buffer overflow, which is even worse! The only real solution is to avoid alloca() and use malloc() everywhere. Or else rewrite make in C++. Or else go with a garbage collector. -- ------------------------------------------------------------------------------- Paul D. Smith <[EMAIL PROTECTED]> Find some GNU make tips at: http://www.gnu.org http://make.mad-scientist.us "Please remain calm...I may be mad, but I am a professional." --Mad Scientist _______________________________________________ Make-w32 mailing list Make-w32@gnu.org http://lists.gnu.org/mailman/listinfo/make-w32