From c58bb0cd464ac681c7193bdf743c9a310d932707 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Fri, 28 Dec 2007 15:23:28 +0000 Subject: [PATCH] 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 --- lib/printf.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/printf.c b/lib/printf.c index 676f4e7..a6767e4 100644 --- a/lib/printf.c +++ b/lib/printf.c @@ -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; -- 2.39.5