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

[Xen-devel] [PATCH][Mini-OS] printf("%n" behavior on overflow



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@xxxxxxxxxx>

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);

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.