From b881217f1716cc02a6606c44f0e436c3a4e70a9e Mon Sep 17 00:00:00 2001 From: Chung-Lin Tang Date: Tue, 17 Sep 2019 17:50:11 +0800 Subject: Fix small error in HP_TIMING_PRINT trailing null char setting 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 --- ChangeLog | 5 +++++ sysdeps/generic/hp-timing-common.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 1541a44968..27be9ac676 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2019-09-17 Chung-Lin Tang + + * sysdeps/generic/hp-timing-common.h (HP_TIMING_PRINT): Correct + position of string null termination. + 2019-09-14 Aurelien Jarno [BZ #24986] diff --git a/sysdeps/generic/hp-timing-common.h b/sysdeps/generic/hp-timing-common.h index f0cc7f2f57..6e03f531fc 100644 --- a/sysdeps/generic/hp-timing-common.h +++ b/sysdeps/generic/hp-timing-common.h @@ -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) -- cgit v1.2.1