bug-gnulib
[Top][All Lists]
Advanced

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

Re: FYI: getdelim.c needs SIZE_MAX


From: Simon Josefsson
Subject: Re: FYI: getdelim.c needs SIZE_MAX
Date: Wed, 05 Oct 2005 22:34:11 +0200
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

Derek Price <address@hidden> writes:

> Paul's recent change to getdelim.c breaks the build on at least NetBSD
> 1.6.1:
>
> 2005-10-03  Paul Eggert  <address@hidden>
>
>         * getdelim.c: Include getdelim.h first.  Include <limits.h>.
>         (SSIZE_MAX): New macro, if not already defined.
>         (getdelim): Fix buffer overrun on 64-bit hosts with lines longer
>         than 2 GiB.
>
> The problem is that the new SSIZE_MAX macro depends on SIZE_MAX, which
> may not be defined.  I've installed the attached patch, ripped verbatim
> from serveral other modules.

Shouldn't we use the size_max module instead?

> 2005-10-05  Derek Price  <address@hidden>
>
>     * getdelim.c (SIZE_MAX): New macro, if not already defined.
>
>
> Regards,
>
> Derek
>
> -- 
> Derek R. Price
> CVS Solutions Architect
> Ximbiot <http://ximbiot.com>
> v: +1 717.579.6168
> f: +1 717.234.3125
> <mailto:address@hidden>
>
> Index: lib/getdelim.c
> ===================================================================
> RCS file: /cvsroot/gnulib/gnulib/lib/getdelim.c,v
> retrieving revision 1.5
> diff -u -p -r1.5 getdelim.c
> --- lib/getdelim.c    3 Oct 2005 19:44:05 -0000       1.5
> +++ lib/getdelim.c    5 Oct 2005 18:05:05 -0000
> @@ -29,6 +29,9 @@
>  #include <stdlib.h>
>  #include <errno.h>
>  
> +#ifndef SIZE_MAX
> +# define SIZE_MAX ((size_t) -1)
> +#endif
>  #ifndef SSIZE_MAX
>  # define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
>  #endif
> _______________________________________________
> bug-gnulib mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/bug-gnulib




reply via email to

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