make-w32
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Make CVS HEAD version build out of the box


From: Paul Smith
Subject: Re: Make CVS HEAD version build out of the box
Date: Wed, 03 Oct 2007 09:29:12 -0400

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 <address@hidden>          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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]