diff --git a/ta/ta_utils.c b/ta/ta_utils.c index 80a42bb16d..860a96436d 100644 --- a/ta/ta_utils.c +++ b/ta/ta_utils.c @@ -106,7 +106,9 @@ static bool strndup_append_at(char **str, size_t at, const char *append, *str = t; } - memcpy(*str + at, append, append_len); + if (append_len) + memcpy(*str + at, append, append_len); + (*str)[at + append_len] = '\0'; ta_dbg_mark_as_string(*str);