WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] In C99 (7.19.6.2.10), the behavior of sca

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] In C99 (7.19.6.2.10), the behavior of scanf("stuff... %n", ..., &n) is
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 28 Dec 2007 12:00:09 -0800
Delivery-date: Fri, 28 Dec 2007 12:00:07 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] In C99 (7.19.6.2.10), the behavior of scanf("stuff... %n", ..., &n) is, Xen patchbot-unstable <=