[PATCH:xman 4/4] Use snprintf to PATH_MAX sized buffers to construct filenames

Guillem Jover guillem at hadrons.org
Tue Feb 1 22:41:55 PST 2011


Hi!

On Fri, 2011-01-28 at 23:14:00 -0800, Alan Coopersmith wrote:
> diff --git a/misc.c b/misc.c
> index 0921307..8818aa8 100644
> --- a/misc.c
> +++ b/misc.c
> @@ -693,7 +693,7 @@ ConstructCommand(cmdbuf, path, filename, tempfile)
>     FILE *file;
>     char fmtbuf[128];
>     int gotfmt = 0;             /* set to 1 if we got a directive from source */
> -   char *fname = NULL;
> +   char fname[PATH_MAX];
>  #ifdef __UNIXOS2__
>     int i;
>  #endif

POSIX does not mandate for a system w/o such limit to define PATH_MAX,
so this will make the build fail there (an example of such a system
could be GNU/Hurd).

regards,
guillem


More information about the xorg-devel mailing list