bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] printf: remove stupid restriction on %n


From: Bruno Haible
Subject: Re: [PATCH] printf: remove stupid restriction on %n
Date: Sun, 09 Sep 2012 18:01:22 +0200
User-agent: KMail/4.7.4 (Linux/3.1.10-1.9-desktop; KDE/4.7.4; x86_64; ; )

Paul Eggert wrote:
> Please see the thread at
> <http://lists.gnu.org/archive/html/bug-gnulib/2007-10/msg00253.html>.

Thanks Paul for digging out the thread.

Andreas, we have to be clear what API gnulib should offer.
  (a) the ability to use %n in every format string, or
  (b) the ability to use %n in read-only format strings only, and
      reject them on writable format strings.

Currently gnulib implements (a), because that is ISO C11. m4/printf.m4
makes sure that if the libc offers only (b), we override printf so that
we get (a).

If you think gnulib should implement (b), then
  1. there would need to be an agreement about it, and your mail was
     incomplete because it did not tell us that your change is an intended
     deviation from ISO C11,
  2. there would need to be a documentation change,
  3. vasnprintf.c should be changed to reject uses of %n in writable memory,
     at least when _FORTIFY_SOURCE == 2 is in use but ideally always.

I'm not particularly in favour of one, (a) or (b). But we should be clear
about what API gnulib offers.

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]