diff options
author | Jakub Jelinek <jakub@redhat.com> | 2011-02-28 21:31:46 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2011-02-28 21:31:46 +0100 |
commit | 9926de2cd8da73d5d949211455df6b0aea65dee5 (patch) | |
tree | 22368093cbef6b62388b5074c8ebcb67297572fc /libquadmath/printf | |
parent | 94369251651270268df0a79ea5917265617b7fb4 (diff) | |
download | gcc-9926de2cd8da73d5d949211455df6b0aea65dee5.zip gcc-9926de2cd8da73d5d949211455df6b0aea65dee5.tar.gz gcc-9926de2cd8da73d5d949211455df6b0aea65dee5.tar.bz2 |
quadmath-printf.c (quadmath_snprintf): Make sure that for size > 0 str is always zero terminated.
* printf/quadmath-printf.c (quadmath_snprintf): Make sure
that for size > 0 str is always zero terminated.
From-SVN: r170572
Diffstat (limited to 'libquadmath/printf')
-rw-r--r-- | libquadmath/printf/quadmath-printf.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libquadmath/printf/quadmath-printf.c b/libquadmath/printf/quadmath-printf.c index 750dc24..b70f432 100644 --- a/libquadmath/printf/quadmath-printf.c +++ b/libquadmath/printf/quadmath-printf.c @@ -256,7 +256,7 @@ quadmath_snprintf (char *str, size_t size, const char *format, ...) qfp.fp = NULL; qfp.str = str; - qfp.size = size; + qfp.size = size ? size - 1 : 0; qfp.len = 0; qfp.file_p = 0; @@ -265,7 +265,7 @@ quadmath_snprintf (char *str, size_t size, const char *format, ...) else __quadmath_printf_fp (&qfp, &info, (const void *const *)&fpnum_addr2); - if (qfp.size) + if (size) *qfp.str = '\0'; return qfp.len; |