This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Building libssp on a system without gets()
- From: Florian Weimer <fw at deneb dot enyo dot de>
- To: Gerald Pfeifer <gerald at pfeifer dot com>
- Cc: Jakub Jelinek <jakub at redhat dot com>, gcc at gcc dot gnu dot org, Ed Maste <emaste at freebsd dot org>
- Date: Sun, 05 Aug 2018 20:56:22 +0200
- Subject: Re: Building libssp on a system without gets()
- References: <alpine.LSU.2.21.1808051730170.3834@anthias.pfeifer.com>
* Gerald Pfeifer:
> some folks in FreeBSD-land have worked to remove all uses of gets()
> and in fact the gets() function itself.
>
> Generally GCC builds just fine in such an environment, except for
> libssp where libssp/gets-chk.c has the following:
>
> char *
> __gets_chk (char *s, size_t slen)
> {
> char *ret, *buf;
>
> if (slen >= (size_t) INT_MAX)
> ==> return gets (s); <==
>
> if (slen <= 8192)
> buf = alloca (slen + 1);
> else
> buf = malloc (slen + 1);
> if (buf == NULL)
> ==> return gets (s); <==
>
>
> Here gets() is used in two edge/error cases only.
>
>
> What do you think of abort()ing on systems where gets() is not
> available, via a bit of autoconf magic? Is this something you
> may be able to help with?
If the system doesn't have gets, you will not need __gets_chk, either.