[RFC v4 1/2] Add [v]aprintf(3)

Alejandro Colomar alx@kernel.org
Fri Mar 20 20:19:13 GMT 2026


Hi Adhemerval,

On 2026-03-20T14:41:25-0300, Adhemerval Zanella Netto wrote:
> 
> 
> On 18/03/26 18:47, Alejandro Colomar wrote:
> > +
> > +#include <libio/libioP.h>
> > +
> > +char *
> > +__vaprintf_chk (int flag, const char *fmt, va_list ap)
> > +{
> > +  /* For flag > 0 (i.e. __USE_FORTIFY_LEVEL > 1) request that %n
> > +     can only come from read-only format strings.  */
> > +  unsigned int mode = (flag > 0) ? PRINTF_FORTIFY : 0;
> > +  char *p;
> > +
> > +  return __vasprintf_internal (&p, fmt, ap, mode) < 0 ? NULL : p;
> > +}
> > +libc_hidden_def (__vaprintf_chk)
> 
> Could you also add the tests to check the fortify wrapper on debug/tst-fortify.c?

Oh, I hadn't noticed that one.  Now that I see it, I'm not sure
I understand what it's testing (it seems to be about %n?).  Would you
mind writing the 'debug/tst-fortify.c' tests for me?  Or maybe explain
to me what I should test (I don't even fully understand what the
fortify wrapper does to this API).


Have a lovely night!
Alex

-- 
<https://www.alejandro-colomar.es>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20260320/b3ddfcfe/attachment.sig>


More information about the Libc-alpha mailing list