tree data BUGFIX init fractions with zero chars
diff --git a/src/tree_data_helpers.c b/src/tree_data_helpers.c
index 5d22eec..e52284e 100644
--- a/src/tree_data_helpers.c
+++ b/src/tree_data_helpers.c
@@ -866,7 +866,7 @@
ly_time_str2ts(const char *value, struct timespec *ts)
{
LY_ERR rc;
- char *fractions_s, frac_buf[10] = {'0'};
+ char *fractions_s, frac_buf[10];
int frac_len;
LY_CHECK_ARG_RET(NULL, value, ts, LY_EINVAL);
@@ -876,6 +876,10 @@
/* convert fractions of a second to nanoseconds */
if (fractions_s) {
+ /* init frac_buf with zeroes */
+ memset(frac_buf, '0', 9);
+ frac_buf[9] = '\0';
+
frac_len = strlen(fractions_s);
memcpy(frac_buf, fractions_s, frac_len > 9 ? 9 : frac_len);
ts->tv_nsec = atol(frac_buf);