> Date: Mon, 16 Aug 2010 09:17:24 -0400
> From: Chris Sutcliffe <ir0nh...@gmail.com>
> 
> As reported on the MinGW-Users mailing list, there is an issue with
> buffer overrun regarding 'MAXPATHLEN'.  MinGW's sys/param.h defines
> 'MAXPATHLEN' as follows:
> 
> #define MAXPATHLEN PATH_MAX
> 
> where 'PATH_MAX' is 259.  The issue is that make expects 'MAXPATHLEN'
> to be considerably bigger (1024).  To correct for it, I created this
> small patch:
> 
> --- make.h.orig 2010-07-20 09:12:06 -0400
> +++ make.h      2010-08-16 08:50:54 -0400
> @@ -130,6 +130,9 @@
>  #  define PATH_MAX      MAXPATHLEN
>  # endif
>  #endif
> +#ifdef __MINGW32__
> +# undef MAXPATHLEN
> +#endif
>  #ifndef MAXPATHLEN
>  # define MAXPATHLEN 1024
>  #endif

IMO, this is wrong.  Windows does not support file names longer than
259 characters.  (Well, it does, but only if Unicode APIs are used,
which the current MinGW build doesn't.)  If Make's sources expect
longer file names (please show where), that's a bug in Make that needs
to be fixed, but not in this way.

Redefining a macro such as MAXPATHLEN that belongs to system header
files is almost never the right solution, because these values are
tightly coupled with the library implementation and the underlying OS
APIs.

_______________________________________________
Make-w32 mailing list
Make-w32@gnu.org
http://lists.gnu.org/mailman/listinfo/make-w32

Reply via email to