Hi Richard,

Richard Sandiford <richard.sandif...@arm.com> wrote:

Jakub Jelinek <ja...@redhat.com> writes:
On Mon, Jan 20, 2020 at 08:59:20AM +0000, Iain Sandoe wrote:

Do you really need one byte extra?  I mean, sizeof ("__parm.") already
includes +1 for the terminating '\0', so unless you append something to
the buffer later, I don't see the point for the + 1.
And the middle line could be written as
     char *buf = XALLOCAVEC (char, namsize);

FWIW, there's also the option of:

        char *buf = ACONCAT ((""__parm.", IDENTIFIER_POINTER (pname), NULL));

But using alloca/ACONCAT is probably a bad idea for unconstrained
user-supplied names, if that's what we have here.

this is a user-supplied identifier, indeed.
so you would suggest it’s safer to use a ggc allocated string?
(there are other places in the code where I should fix this too, in that case)

Iain

Reply via email to