]> sourceware.org Git - newlib-cygwin.git/commit
Don't overread or write memory returned by _DTOA_R
authorSilviu Baranga <silviu.baranga@arm.cm>
Mon, 5 Jun 2017 08:54:42 +0000 (09:54 +0100)
committerCorinna Vinschen <corinna@vinschen.de>
Fri, 9 Jun 2017 13:30:47 +0000 (15:30 +0200)
commitefaef1bba263501e1e7264833ddfc9b8c20f9ebc
treeaa7a5845d4d817b38254880e6bdd0e60886f2787
parent556200022524a7baf9d1f85b50322a40306f004d
Don't overread or write memory returned by _DTOA_R

Don't over-read memory returned by _DTOA_R, and never write to it
since the result might be a string literal.

For example, when doing:
  swprintf(tt, 20, L"%.*f", 6, 0.0);

we will get back "0".

Instead, write the result returned by _DTOA_R to the output buffer.
After this, write the 0 chars directly to the the output buffer
(if there are any). This also has the (marginal) advantage that
we read/write less memory overall.
newlib/libc/stdio/vfwprintf.c
This page took 0.029561 seconds and 5 git commands to generate.