From: Jonathan Wakely Date: Thu, 16 Feb 2017 12:06:28 +0000 (+0000) Subject: PR libstdc++/60936 fix length calculation X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=728e81e3bcbcff0ab4e745c98dd5cde89c02a90d;p=gcc.git PR libstdc++/60936 fix length calculation PR libstdc++/60936 * src/c++11/snprintf_lite.cc (__concat_size_t): Calculate length written to buffer, not length remaining in buffer. From-SVN: r245505 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 5ce466fa9ec..c73d75fdf83 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,9 @@ +2017-02-16 Jonathan Wakely + + PR libstdc++/60936 + * src/c++11/snprintf_lite.cc (__concat_size_t): Calculate length + written to buffer, not length remaining in buffer. + 2017-02-15 Tim Shen PR libstdc++/78723 diff --git a/libstdc++-v3/src/c++11/snprintf_lite.cc b/libstdc++-v3/src/c++11/snprintf_lite.cc index 1a408ca1d8f..de132d92dd4 100644 --- a/libstdc++-v3/src/c++11/snprintf_lite.cc +++ b/libstdc++-v3/src/c++11/snprintf_lite.cc @@ -81,7 +81,7 @@ namespace __gnu_cxx { __val /= 10; } while (__val != 0); - size_t __len = __out - __cs; + size_t __len = __cs + __ilen - __out; if (__bufsize < __len) return -1;