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

[Xen-changelog] [xen-3.1-testing] In C99 (7.19.6.2.10), the behavior of scanf("stuff... %n", ..., &n) is



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1198856830 0
# Node ID 51cbb2440b565475e6e8b0c2a004022b350b566d
# Parent  690a80169633678512629bf68da972bc7f389ec5
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>
xen-unstable changeset:   16671:19f549449cb5
xen-unstable date:        Fri Dec 28 15:23:28 2007 +0000
---
 extras/mini-os/lib/printf.c |    4 +---
 xen/common/vsprintf.c       |    4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)

diff -r 690a80169633 -r 51cbb2440b56 extras/mini-os/lib/printf.c
--- a/extras/mini-os/lib/printf.c       Thu Dec 27 22:57:41 2007 +0000
+++ b/extras/mini-os/lib/printf.c       Fri Dec 28 15:47:10 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);
@@ -446,7 +444,7 @@ int vsnprintf(char *buf, size_t size, co
             ++str;
             continue;
 
-                        /* integer number formats - set up the flags and 
"break" */
+            /* integer number formats - set up the flags and "break" */
         case 'o':
             base = 8;
             break;
diff -r 690a80169633 -r 51cbb2440b56 xen/common/vsprintf.c
--- a/xen/common/vsprintf.c     Thu Dec 27 22:57:41 2007 +0000
+++ b/xen/common/vsprintf.c     Fri Dec 28 15:47:10 2007 +0000
@@ -404,8 +404,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);
@@ -424,7 +422,7 @@ int vsnprintf(char *buf, size_t size, co
             ++str;
             continue;
 
-                        /* integer number formats - set up the flags and 
"break" */
+            /* integer number formats - set up the flags and "break" */
         case 'o':
             base = 8;
             break;

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


 


Rackspace

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