Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/stdio/vfprintf.c')
-rw-r--r--newlib/libc/stdio/vfprintf.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/newlib/libc/stdio/vfprintf.c b/newlib/libc/stdio/vfprintf.c
index 5e6c61ca4..dd9c22a6d 100644
--- a/newlib/libc/stdio/vfprintf.c
+++ b/newlib/libc/stdio/vfprintf.c
@@ -1521,9 +1521,11 @@ string:
*/
char *p = memchr (cp, 0, prec);
- if (p != NULL)
+ if (p != NULL) {
size = p - cp;
- else
+ if (size > prec)
+ size = prec;
+ } else
size = prec;
} else
size = strlen (cp);