summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-03-23 18:03:45 +0100
committerwm4 <wm4@nowhere>2015-03-23 18:03:45 +0100
commit16a5c6c5359e0471bf985da5a65bef5a0aedbf80 (patch)
treede78896ff8c6d6f60553f8d76915db813d52f253
parentab37a77b36dbd6f9b2350d62faf301d1ef8acef3 (diff)
downloadmpv-16a5c6c5359e0471bf985da5a65bef5a0aedbf80.tar.bz2
mpv-16a5c6c5359e0471bf985da5a65bef5a0aedbf80.tar.xz
ta: memcpy(ptr, NULL, 0) is undefined
-rw-r--r--ta/ta_utils.c4
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);