diff options
author | wm4 <wm4@nowhere> | 2015-03-23 18:03:45 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-03-23 18:03:45 +0100 |
commit | 16a5c6c5359e0471bf985da5a65bef5a0aedbf80 (patch) | |
tree | de78896ff8c6d6f60553f8d76915db813d52f253 | |
parent | ab37a77b36dbd6f9b2350d62faf301d1ef8acef3 (diff) |
ta: memcpy(ptr, NULL, 0) is undefined
-rw-r--r-- | ta/ta_utils.c | 4 |
1 files changed, 3 insertions, 1 deletions
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); |