Re: [PATCH] tools: include: add proper strscpy() declaration
From: Maxwell Doose
Date: Wed May 06 2026 - 00:22:03 EST
On Mon, May 4, 2026 at 4:47 PM Maxwell Doose <m32285159@xxxxxxxxx> wrote:
>
> On Mon, May 4, 2026 at 4:38 PM Maxwell Doose <m32285159@xxxxxxxxx> wrote:
> >
> > On Mon, May 4, 2026 at 4:23 PM Lucas Poupeau <lucasp.linux@xxxxxxxxx> wrote:
> > >
> > > Currently, strscpy() is defined as a macro for strcpy() in the tools
> > > headers. This is unsafe and prevents using the real strscpy() logic
> > > that provides better buffer overflow protection.
> > >
> > > Remove the macro hack and add a proper extern declaration for
> > > strscpy(). This allows tools to use the safer string copying API
> > > once the implementation is provided.
> > >
> > > Suggested-by: Maxwell Doose <m32285159@xxxxxxxxx>
> > > Signed-off-by: Lucas Poupeau <lucasp.linux@xxxxxxxxx>
> > >
> > [snip]
> > >
> > > +extern ssize_t strscpy(char *dest, const char *src, size_t count);
> > > +
> > > +char *str_error_r(int errnum, char *buf, size_t buflen);
> > > +
> > > char *str_error_r(int errnum, char *buf, size_t buflen);
> > >
> >
> > Looks like you have a duplicate definition here.
> >
> > best regards,
> > max
> >
>
> Also would be worth checking sashiko's report:
> https://sashiko.dev/#/patchset/20260504212301.63750-1-lucasp.linux%40gmail.com
>
By the way, Wei gave you the greenlight to go forward with this so
make sure to add:
Fixes: 9e3d665 ("memblock test: fix implicit declaration of function 'strscpy'")
but maybe note that this doesn't need to be backported.
> best regards,
> max