Re: [PATCH] Fix buffer not null terminated on (ecpg lib) - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [PATCH] Fix buffer not null terminated on (ecpg lib)
Date
Msg-id 2146210.1623469221@sss.pgh.pa.us
Whole thread Raw
In response to [PATCH] Fix buffer not null terminated on (ecpg lib)  (Ranier Vilela <ranier.vf@gmail.com>)
List pgsql-hackers
Andres Freund <andres@anarazel.de> writes:
> On 2021-06-11 19:08:57 -0400, Tom Lane wrote:
>> Anyway, I agree that disabling that was a bit of a stopgap hack.  This
>> 'nonstring' attribute seems like it would help for ECPG's usage, at
>> least.

> nonstring is supported since gcc 8, which also brought the warnings that
> e71658523 is concerned about. Which makes me think that we should be
> able to get away without a configure test. The one complication is that
> the relevant ecpg code doesn't include c.h.

Ugh.  And we *can't* include that there.

> But I think we can just do something like:

> -    char        sqlstate[5];
> +    char        sqlstate[5]
> +#if defined(__has_attribute) && __has_attribute(nonstring)
> +    __attribute__((nonstring))
> +#endif
> +    ;
>  };

Hmm.  Worth a try, anyway.

> Should we also include a pg_attribute_nonstring definition in c.h?
> Probably not, given that we right now don't have another user?

Yeah, no point till there's another use-case.  (I'm not sure
there ever will be, so I'm not excited about adding more
infrastructure than we have to.)

            regards, tom lane



pgsql-hackers by date:

Previous
From: Thomas Munro
Date:
Subject: Re: An out-of-date comment in nodeIndexonlyscan.c
Next
From: Justin Pryzby
Date:
Subject: Re: PG 14 release notes, first draft