]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix small error in HP_TIMING_PRINT trailing null char setting
authorChung-Lin Tang <cltang@codesourcery.com>
Tue, 17 Sep 2019 09:50:11 +0000 (17:50 +0800)
committerChung-Lin Tang <cltang@codesourcery.com>
Tue, 17 Sep 2019 09:50:11 +0000 (17:50 +0800)
Fix a small error in the HP_TIMING_PRINT trailing zero setting; the '\0'
should be set at MIN(Len,string length), instead of always at the 'Len'
position.

* sysdeps/generic/hp-timing-common.h (HP_TIMING_PRINT): Correct
position of string null termination.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
ChangeLog
sysdeps/generic/hp-timing-common.h

index 1541a44968eaa83586a6f8c0b9961f8307b443d2..27be9ac6764dfaa62a715a02a2c0dd40c14ccea3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2019-09-17  Chung-Lin Tang  <cltang@codesourcery.com>
+
+       * sysdeps/generic/hp-timing-common.h (HP_TIMING_PRINT): Correct
+       position of string null termination.
+
 2019-09-14  Aurelien Jarno  <aurelien@aurel32.net>
 
        [BZ #24986]
index f0cc7f2f57564d772a592861c75581f93d0d95a2..6e03f531fc056126f543dbd680b8481562fa3dbe 100644 (file)
@@ -56,5 +56,5 @@
     char *__cp = _itoa ((Val), __buf + sizeof (__buf), 10, 0);         \
     size_t __cp_len = MIN (__buf + sizeof (__buf) - __cp, __len);      \
     memcpy (__dest, __cp, __cp_len);                                   \
-    __dest[__len - 1] = '\0';                                          \
+    __dest[__cp_len - 1] = '\0';                                       \
   } while (0)