make-w32
[Top][All Lists]
Advanced

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

Re: Minor patch to correct buffer overrun


From: Eli Zaretskii
Subject: Re: Minor patch to correct buffer overrun
Date: Mon, 16 Aug 2010 20:22:45 +0300

> Date: Mon, 16 Aug 2010 09:17:24 -0400
> From: Chris Sutcliffe <address@hidden>
> 
> 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.



reply via email to

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