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

Adhemerval Zanella Netto adhemerval.zanella@linaro.org
Fri Mar 20 17:41:25 GMT 2026



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?


More information about the Libc-alpha mailing list