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>
This commit is contained in:
Keir Fraser committed 2007-12-28 15:23:28 +00:00
1 parent f53513b012
commit 8f8a3b5659
2 files changed
+2 -6

No files matched your search

+1 -3
View File
@@ -426,8 +426,6 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
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, const char *fmt, va_list args)
++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;
+1 -3
View File
@@ -404,8 +404,6 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
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, const char *fmt, va_list args)
++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;
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.