summaryrefslogtreecommitdiffstats
path: root/misc
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-11-21 05:13:40 +0100
committerwm4 <wm4@nowhere>2014-11-21 05:18:11 +0100
commit9c456ab58f7b298400a050aecdf49de4e035528d (patch)
tree48dd6884de60a814bed80b113ae09b2393339eff /misc
parent85fb2af369e9ea8638beaf3a34865e3553329a02 (diff)
downloadmpv-9c456ab58f7b298400a050aecdf49de4e035528d.tar.bz2
mpv-9c456ab58f7b298400a050aecdf49de4e035528d.tar.xz
bstr: don't call memcpy(..., NULL, 0)
This is clearly not allowed, although it's not a problem on most libcs. Found by Coverity.
Diffstat (limited to 'misc')
-rw-r--r--misc/bstr.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/misc/bstr.c b/misc/bstr.c
index 7a5a1a1270..7db7015e1c 100644
--- a/misc/bstr.c
+++ b/misc/bstr.c
@@ -379,6 +379,8 @@ static void resize_append(void *talloc_ctx, bstr *s, size_t append_min)
// talloc_ctx will be used as parent context, if s->start is NULL.
void bstr_xappend(void *talloc_ctx, bstr *s, bstr append)
{
+ if (!append.len)
+ return;
resize_append(talloc_ctx, s, append.len + 1);
memcpy(s->start + s->len, append.start, append.len);
s->len += append.len;