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

[Xen-changelog] [xen-unstable] 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 1198855408 0
# Node ID 19f549449cb5ed7e60c86b63b25702d24f31bd47
# Parent  4624795a2346438bab8115b6a5eac7218be9e6d9
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>
---
 extras/mini-os/lib/printf.c |    4 +---
 xen/common/vsprintf.c       |    4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)

diff -r 4624795a2346 -r 19f549449cb5 extras/mini-os/lib/printf.c
--- a/extras/mini-os/lib/printf.c       Thu Dec 27 23:01:50 2007 +0000
+++ b/extras/mini-os/lib/printf.c       Fri Dec 28 15:23:28 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 4624795a2346 -r 19f549449cb5 xen/common/vsprintf.c
--- a/xen/common/vsprintf.c     Thu Dec 27 23:01:50 2007 +0000
+++ b/xen/common/vsprintf.c     Fri Dec 28 15:23:28 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®.