PR libstdc++/60936 fix length calculation
authorJonathan Wakely <jwakely@redhat.com>
Thu, 16 Feb 2017 12:06:28 +0000 (12:06 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Thu, 16 Feb 2017 12:06:28 +0000 (12:06 +0000)
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

libstdc++-v3/ChangeLog
libstdc++-v3/src/c++11/snprintf_lite.cc

index 5ce466fa9ec72b17e73d5afdacea1bccfe6a8050..c73d75fdf83ebfb940b3a715ebc2ef7ead39b2e8 100644 (file)
@@ -1,3 +1,9 @@
+2017-02-16  Jonathan Wakely  <jwakely@redhat.com>
+
+       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  <timshen@google.com>
 
        PR libstdc++/78723
index 1a408ca1d8f7ecb0f833557fd9181a66a49d1ef6..de132d92dd498c8bd07fb3f4088a5da3762b7f96 100644 (file)
@@ -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;