All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][Mini-OS] printf("%n" behavior on overflow
@ 2007-12-28 12:08 Samuel Thibault
  0 siblings, 0 replies; only message in thread
From: Samuel Thibault @ 2007-12-28 12:08 UTC (permalink / raw)
  To: xen-devel

Hello,

In C99 (7.19.6.2.10), the behavior of scanf("stuff... %n", ..., &n) is
said to be undefined if the value to be put is n can't fit.  I guess we
can safely consider that the same applies to printf.

Signed-off-by: Samuel Thibault <samuel.thibault@citrix.com>

diff -r 5da126f8960e -r 077f5106d691 extras/mini-os/lib/printf.c
--- a/extras/mini-os/lib/printf.c	Fri Dec 28 11:52:16 2007 +0000
+++ b/extras/mini-os/lib/printf.c	Fri Dec 28 12:01:05 2007 +0000
@@ -426,8 +426,6 @@ int vsnprintf(char *buf, size_t size, co
 
 
         case 'n':
-            /* FIXME:
-             * What does C99 say about the overflow case here? */
             if (qualifier == 'l') {
                 long * ip = va_arg(args, long *);
                 *ip = (str - buf);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-12-28 12:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-28 12:08 [PATCH][Mini-OS] printf("%n" behavior on overflow Samuel Thibault

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.