mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-15 21:01:09 +08:00
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
This commit is contained in:
parent
9436925165
commit
9926de2cd8
@ -1,3 +1,8 @@
|
||||
2011-02-28 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* printf/quadmath-printf.c (quadmath_snprintf): Make sure
|
||||
that for size > 0 str is always zero terminated.
|
||||
|
||||
2011-02-20 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR bootstrap/47827
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user